How do entrypoint scripts commonly break signal handling and how do you fix it?
IntermediateProductionResource Limits, Health & Reliability
Answer
A script that ends with python app.py leaves bash as PID 1; SIGTERM never reaches Python. Use exec so the app replaces the shell:
#!/bin/sh
set -e
envsubst < /app/config.tmpl > /app/config.yml
exec "$@"
Keep ENTRYPOINT ["/entrypoint.sh"] and CMD ["app"].
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