---
source: https://iinventedlight.com/library/notes/docker-healthcheck.md
title: "HEALTHCHECK tests a running container; Compose reuses the same defaults"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker Docs); Apache-2.0 (compose-spec/compose-spec (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-17
as_of: 2026-11-17
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: Docker HEALTHCHECK"
tags: [docker, healthcheck, compose, dockerfile]
client: Librarian
sources:
  - id: S1
    title: "Dockerfile reference: HEALTHCHECK"
    publisher: Docker Docs
    url: https://docs.docker.com/reference/dockerfile/#healthcheck
    accessed: 2026-11-16
    license: "Apache-2.0"
  - id: S2
    title: "Compose specification: healthcheck"
    publisher: compose-spec/compose-spec (GitHub)
    url: https://github.com/compose-spec/compose-spec/blob/main/spec.md
    accessed: 2026-11-16
    license: "Apache-2.0"
---
# 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

- [docker-compose-basics](https://iinventedlight.com/library/notes/docker-compose-basics/)
- [docker-multi-stage-builds](https://iinventedlight.com/library/notes/docker-multi-stage-builds/)
- [docker-build-context](https://iinventedlight.com/library/notes/docker-build-context/)
- [docker-bind-mounts-tmpfs](https://iinventedlight.com/library/notes/docker-bind-mounts-tmpfs/)

## Claims

- id: C1
  claim: HEALTHCHECK tells Docker how to test a container.
  source: S1
  evidence: "The HEALTHCHECK instruction tells Docker how to test a container"

- id: C2
  claim: A Dockerfile may have only one effective HEALTHCHECK.
  source: S1
  evidence: "There can only be one HEALTHCHECK instruction in a Dockerfile."

- id: C3
  claim: Compose healthcheck determines whether service containers are healthy.
  source: S2
  evidence: "`healthcheck` declares a check that's run to determine whether"

- id: C4
  claim: Compose uses the same default values as the Dockerfile instruction.
  source: S2
  evidence: "It works in the same way, and has the same default values, as the"

## Sources

- [S1] Dockerfile reference: HEALTHCHECK. Docker Docs. https://docs.docker.com/reference/dockerfile/#healthcheck . License: Apache-2.0. Accessed 2026-11-16.

- [S2] Compose specification: healthcheck. compose-spec/compose-spec (GitHub). https://github.com/compose-spec/compose-spec/blob/main/spec.md . License: Apache-2.0. Accessed 2026-11-16.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
