Container images should include HEALTHCHECK instructions
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Description
Images should define a HEALTHCHECK.
Rationale
With a health check, Docker tests the containers of the image and reports those that stop working, and orchestrators can replace them.
Audit
Show the health check of the images:
docker images --quiet | xargs docker inspect --format '{{ .Id }}: Healthcheck={{ .Config.Healthcheck }}'
Datadog passes the rule when an image defines a health check other than NONE, and fails it otherwise. It judges the images that a container can name by a tag or a repository digest. It leaves out the images with neither that the classic builder keeps for each build step.
Add a HEALTHCHECK instruction to the Dockerfile and rebuild the image:
HEALTHCHECK --interval=30s CMD curl -f http://localhost/ || exit 1
Impact
None.
Default value
Images define a health check only when their Dockerfile does.
References
- https://docs.docker.com/reference/dockerfile/#healthcheck