How do you configure a good `HEALTHCHECK` for production?
IntermediateProductionResource Limits, Health & Reliability
Answer
Check app-level readiness (dependencies reachable) without being expensive, with timeouts shorter than interval, and a start-period for slow starters.
HEALTHCHECK --interval=15s --timeout=3s --start-period=30s --retries=3 \
CMD ["wget","-qO-","http://127.0.0.1:8080/healthz"]
Use binaries present in the image (distroless has no curl; ship a tiny healthcheck binary or use the app's own --health flag).
More on Resource Limits, Health & Reliability
How do you set memory and CPU limits, and what happens when they are exceeded?BeginnerWhat is the difference between `--cpus`, `--cpu-shares` and `--cpuset-cpus`?BeginnerWhat does `--memory-reservation` do?AdvancedHow do you diagnose an OOM-killed container?IntermediateWhy do JVM and Node services in containers need explicit memory flags?IntermediateWhat is CPU throttling, and how do you detect it?Advanced