Skip to content

Healthcheck instructions have not been added to container images

Description

This rule detects whether HEALTHCHECK instructions have been added to Docker container images. These instructions provide a way to check the health of the running container, ensuring that issues are detected and handled promptly, improving the reliability and stability of your containerized applications. Adding HEALTHCHECK instructions to your Dockerfiles follows best practices for Docker container health management.

Code Example

dockerfile
+ HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD curl -f http://localhost/health || exit 1

Remediation

Docker

To mitigate this issue, add HEALTHCHECK instructions to your Dockerfile. Define a command that will be used to check the health of the container and specify the interval, timeout, and retries for how often the check should be performed.

Example:

Rule Details

FieldValue
IDIAC-0835
SeverityLOW
IaC Typedockerfile
FrameworksDocker
Checkov IDCKV_DOCKER_2

References