Docker Compose healthcheck example suggests incorrect usage of healthcheck feature
Is this a docs issue?
- [x] My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
The documentation says:
For more information on HEALTHCHECK, see the Dockerfile reference.
The Dockerfile reference says:
The command's exit status indicates the health status of the container. The possible values are:
- 0: success - the container is healthy and ready for use
- 1: unhealthy - the container isn't working correctly
- 2: reserved - don't use this exit code
However, the Docker Compose documentation gives this example:
test: ["CMD", "curl", "-f", "http://localhost"]
curl usually produces an exit status other than 1 for errors.
Location
https://docs.docker.com/reference/compose-file/services/#healthcheck
Suggestion
No response
Thanks for reporting; I need to check the implementation (whether it only accepts 1 as exit-code for "unhealthy"), but at least the Dockerfile reference could probably use a bit more wording around the example normalising to 1 for this, and the compose example to be updated accordingly.