docker icon indicating copy to clipboard operation
docker copied to clipboard

Fix graceful shutdown

Open sugtao4423 opened this issue 1 month ago • 0 comments

Problem

docker compose down takes 10 seconds and Docker forcefully kills the container because graceful shutdown doesn't work.

Root cause: The bash script in koel-entrypoint becomes PID 1, and doesn't forward signals (like SIGWINCH/SIGTERM) to the Apache child process. Docker waits for timeout, then sends SIGKILL.

Solution

Use exec to replace bash with Apache as PID 1, so signals reach Apache directly.

Also quotes "$@" for proper argument handling (best practice).

Result

Container now shuts down gracefully in 1-2 seconds instead of being killed after 10 seconds.

sugtao4423 avatar Nov 29 '25 18:11 sugtao4423