Search code examples
dockercontainers

HEALTHCHECK in Dockerfile


Is having HEALTHCHECK NONE in Dockerfile same as not specifying HEALTHCHECK in Dockerfile ?

I can't seem to find any documentation about this. Would appreciate any pointers around this


Solution

  • According to Docker reference documentation: https://docs.docker.com/engine/reference/builder/#healthcheck

    HEALTHCHECK NONE (disable any healthcheck inherited from the base image)

    So the answer in no - it is not the same. If you code the line in your Dockerfile - you also disable (if present) any healthchecks provided from your base image.

    So imagine you built your image on top of other image (suppose node alpine), then- if node alpine image would have HEALTHCHECK ... configured in its Dockerfile, then doing HEALTHCHECK NONE in your dockerfile - disables the origin healthcheck.