CICD-134 · Run a runtime health probe inside the image
Encyclopedia · Docker runtime and Compose · All snippets
Previous · CICD-133 · Next · CICD-135
1. Where it fits
- Placement Bash run step following checkout, or equivalent lab terminal.
- Prerequisites disposable Docker or Compose project with example web service.
- Platforms local-linux, github-actions, gitea-actions.
- Parameters
CONTAINER_ID.
2. Copy the snippet
bash
docker inspect --format '{{.State.Health.Status}}' "${CONTAINER_ID:?}" | grep -Fx healthy3. How it works
Inspect reads the container health state recorded by Docker. The final exact-match check accepts only healthy and fails if a configured probe reports anything else.
4. Verify the result
Supply a Dockerfile or Compose healthcheck and poll with a deadline.
Validation syntax-validated (Bash parse). Status definitions.