Interview Prep/Docker/Resource Limits, Health & Reliability

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"].

All Docker questions Roadmap: Docker & containers

More on Resource Limits, Health & Reliability