How to send a signal to a Docker container without affecting restart policy?

leedm777 asked:

TIL that docker kill means kill in the sense of "make it dead", as opposed to the POSIX sense of "send a signal".

We have several containers that we need to send a SIGHUP to in order to reload configuration, but this causes them to ignore their restart policy of "always", which isn’t what we want.

What’s the best way to send signals to these containers without affecting their ability to auto-restart?

My answer:


With the --signal option to docker kill?

docker kill --signal=SIGHUP <container>

Or with docker exec?

docker exec <container> killall -HUP nginx

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.