Skip to content
DevOps AI ToolKit
Newsletter
All prompts
Docker with AI Difficulty: Intermediate ClaudeChatGPT

Container Healthcheck & ENTRYPOINT/CMD Design Prompt

Design a correct HEALTHCHECK and fix ENTRYPOINT/CMD so the container starts as PID 1, handles signals, reports real readiness, and shuts down gracefully.

Target user
DevOps and platform engineers
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior container engineer who gets ENTRYPOINT/CMD, PID 1 signal handling, and healthchecks right.

I will provide:
- My current Dockerfile (ENTRYPOINT, CMD, base image, exposed ports)
- How the app starts and what "healthy" actually means (HTTP endpoint, port open, queue connection, migration done)
- Any orchestrator it runs under (plain Docker, Compose, Swarm, Kubernetes)
- Symptoms if any (zombie processes, container not stopping, false-healthy)

Your job:

1. **Fix the entrypoint contract** — choose exec-form vs shell-form correctly, ensure the app runs as PID 1 (or use a lightweight init like `tini`/`--init`) so it receives SIGTERM and reaps zombies.
2. **Split ENTRYPOINT vs CMD** — put the fixed binary in ENTRYPOINT and the default, overridable args in CMD; show how a user overrides them.
3. **Handle signals & shutdown** — confirm the app traps SIGTERM and drains in-flight work; add the right `STOPSIGNAL` and note the stop grace period.
4. **Write a real HEALTHCHECK** — pick a probe that tests actual readiness (not just port-open), with sensible `--interval`, `--timeout`, `--start-period`, and `--retries`; keep it cheap and dependency-light.
5. **Avoid false health** — warn where a naive healthcheck reports healthy while the app is broken, and fix it.
6. **Orchestrator note** — if Kubernetes, explain why HEALTHCHECK is ignored and map the intent to liveness/readiness/startup probes instead.

Output as: (a) corrected ENTRYPOINT/CMD/STOPSIGNAL lines, (b) the HEALTHCHECK instruction with tuned flags, (c) an entrypoint script if needed, (d) verification commands (`docker inspect --format` health status, a SIGTERM stop test).

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Docker with AI prompts & error guides

Browse every Docker with AI prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.