HEALTHCHECK: Dockerfile vs docker-compose.yml

Adding health check to the Dockerfile, will make the health-check part of the image, so that anyone pulling the image from the registry will get the health check by default.

Compose files are usually less shared than the actual docker images they run. The dockercompose health-check allows adding/overrriding healthchecks for images for someone who is not creating the image but rather is pulling it from a remote registry.
It is more suitable in situations where the pulled image doesn’t have a health-check by default.

In your case, since you are creating the image, adding the health-check to the dockerfile makes more sense.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)