`docker stop` on your container always takes 10 seconds and ends with `Exited (137)`. The entrypoint is a Bash script that starts the app.
Likely causes → The script is PID 1 and starts the app as a child. Docker sends SIGTERM to PID 1; Bash does not forward it to the child, and as PID 1 it has no default TERM handler, so nothing happens until Docker sends SIGKILL after the grace period (137 = 128 + 9). The app never gets to drain connections.
Diagnose →
docker exec app ps -o pid,ppid,args # PID 1 is bash, the app is a child
docker inspect -f '{{.State.ExitCode}}' app # 137
Fix → Replace the shell with the app once setup is done, so the app becomes PID 1 and receives signals directly:
#!/usr/bin/env bash
set -Eeuo pipefail
/app/bin/render-config
exec /app/bin/server --port 8080
If the script must stay alive (for post-exit work), forward the signal: start the app in the background, trap 'kill -TERM "$pid"' TERM INT, then wait "$pid", and wait again after the trap. Or run with docker run --init (tini) for zombie reaping.
Prevent → Use exec for the final command in every entrypoint; test with docker stop -t 30 and check the exit code is 0 or 143, not 137.