← All notes

HEALTHCHECK tests a running container; Compose reuses the same defaults

Answer: The Dockerfile HEALTHCHECK instruction tells Docker how to test a running container. The form is HEALTHCHECK [OPTIONS] CMD command, or HEALTHCHECK NONE to disable a check inherited from the base image. A container with a check has a status of starting, then healthy after a pass, then unhealthy after a configured number of consecutive failures. There can be only one HEALTHCHECK instruction; the last one wins. Exit status 0 means success, 1 means the container is not working correctly.

Compose healthcheck declares the same kind of check for a service and uses the same default values as the Dockerfile instruction.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker Docs, Dockerfile reference: HEALTHCHECK, Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Docker docs; Docker name and logo are trademarks of Docker Inc and are not licensed; compose-spec/compose-spec (GitHub), Compose specification: healthcheck, Apache-2.0 (https://raw.githubusercontent.com/compose-spec/compose-spec/master/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker Docs, Dockerfile reference: HEALTHCHECK, Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Docker docs; Docker name and logo are trademarks of Docker Inc and are not licensed; compose-spec/compose-spec (GitHub), Compose specification: healthcheck, Apache-2.0 (https://raw.githubusercontent.com/compose-spec/compose-spec/master/LICENSE).

Cite this

Permanent ID: iil:note:j108w51e

iinventedlight. 2026. "HEALTHCHECK tests a running container; Compose reuses the same defaults." iinventedlight Library, iil:note:j108w51e, version of 2026-11-16. https://iinventedlight.com/library/notes/docker-healthcheck/. License: CC-BY-4.0.

@misc{iil_note_j108w51e,
  author = {{iinventedlight}},
  title = {{HEALTHCHECK tests a running container; Compose reuses the same defaults}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/docker-healthcheck/},
  note = {Permanent ID iil:note:j108w51e. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-healthcheck.md.