In-case if you run a Docker image and after that you try to kill it, the kill signal is not detected by the Docker container process and in that scenario you have to resort to restarting your Docker process. This is because, the Docker image on which the container is built upon, doesnot detect the Kill Signal i.e. doesnot register any listeners for the kill signal and in this process the signal gets lost whenever fired. Considering on of the most popular Docker Library: mysql also has the same issue.
Issue: Container does not catch signals and exit "Ctrl+C"
In that case you can use the following solution:
- Create a file
docker-shutdown-patch.sh
in the same directory as your Dockerfile - In the Dockerfile, change the EntryPoint and CMD defaults of the image as in the sample Dockerfile.
- Build the image and start the container