Catching SIGTERM from alpine image
问题 I was trying to catch SIGTERM signal from a docker instance (basically when docker stop is called) but couldn't find a way since I have different results for each try I performed. Following is the setup I have Dockerfile FROM gitlab/gitlab-runner:alpine COPY ./start.sh /start.sh ENTRYPOINT ["/start.sh"] start.sh #!/bin/bash deregister_runner() { echo "even if nothing happened, something happened" exit } trap deregister_runner SIGTERM while true; do sleep 10 done Now I build the docker image $