Mariadb-docker: Implement HEALTHCHECK instruction

Created on 11 Jan 2017  Â·  7Comments  Â·  Source: MariaDB/mariadb-docker

There is a new Dockerfile instruction HEALTHCHECK what is useful for detecting if container is still starting (and other should wait) or unhealthy.

It it enought to write something like this?

HEALTHCHECK CMD mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD -e "show databases;"

Most helpful comment

This' how is made it

mariadb: image: mariadb restart: always volumes: - './mariadb/:/var/lib/mysql/' healthcheck: test: ["CMD", "mysqladmin", "ping", "--silent"]

All 7 comments

Maybe to make it working also if MYSQL_USER or MYSQL_PASSWORD is not filled → use root. Then if MYSQL_ALLOW_EMPTY_PASSWORD and other related settings.

Any ideas?

https://github.com/docker-library/cassandra/pull/76#issuecomment-246054271 has some good points regarding adding default health checks to official images :+1:

(https://github.com/docker-library/healthcheck also has copies of several images with reasonably-generic HEALTHCHECK instructions added)

Current stance is still the same as linked above in cassandra.

I do not feel that generalized healthchecks on the official images are really that useful.

  • users will have their own idea of what is "healthy"
  • it does not actually test that the service is listening to connections outside of localhost (see https://github.com/docker-library/healthcheck for some examples that do more than what's proposed here, including attempting to check whether the service is listening remotely)

    • some of the Official Images even purposely start in a localhost only mode for database initialization and then kill and start the main service with full network availability

  • after upgrading their images, current users will have extra unexpected load on their systems for healthchecks they don't necessarily need/want and may be unaware of

Closing old issue.

This' how is made it

mariadb: image: mariadb restart: always volumes: - './mariadb/:/var/lib/mysql/' healthcheck: test: ["CMD", "mysqladmin", "ping", "--silent"]

Pay attention, if you use the /docker-entrypoint-initdb.d folder to run some SQL scripts at runtime, it may be useful to test if data is ready instead of just the server.

Pay attention, if you use the /docker-entrypoint-initdb.d folder to run some SQL scripts at runtime, it may be useful to test if data is ready instead of just the server.

That's an issue. Can we reopen this issue? If you have entrypoint sql or sh, the healthcheck from @SalathielGenese does not work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danquah picture danquah  Â·  6Comments

amon-ra picture amon-ra  Â·  3Comments

dbjpanda picture dbjpanda  Â·  5Comments

amq picture amq  Â·  4Comments

o-alquimista picture o-alquimista  Â·  3Comments