Which `HEALTHCHECK` command do you use in a distroless image with no `curl`?
IntermediateScenarioImage design and Dockerfile decisions
Answer
Situation read → No shell and no curl means a Dockerfile HEALTHCHECK CMD curl fails.
What I'd do → Add a tiny health subcommand to the app binary (/app healthcheck) and use exec form:
HEALTHCHECK --interval=15s --timeout=3s --start-period=20s --retries=3 \
CMD ["/app", "healthcheck"]
Alternatively rely on orchestrator probes (Kubernetes HTTP probes) instead of Docker's.
Why → Keeps the image minimal while retaining health semantics.
Interview tip → In Kubernetes, the Dockerfile HEALTHCHECK is ignored; use probes.
More on Image design and Dockerfile decisions
A teammate's Node.js image is 1.2 GB. How do you approach shrinking it?BeginnerYou need to run `apt-get install` in a Dockerfile. How do you write it so the layer stays small and cache-safe?BeginnerWhen would you pick `COPY` over `ADD`?BeginnerA service must run a startup script and then the app. Should you use `CMD`, `ENTRYPOINT`, or both?BeginnerYour Docker build re-installs all Python dependencies on every code change. Fix it.BeginnerProduct asks for a container that runs both nginx and a Python app. What do you say?Beginner