Docker Community Forums

Share and learn in the Docker community.

Smoothly restart docker container


(Zh99998) #1

could docker container be smoothly restart?
I mean, like nginx -s reload
start a new instance listen to the port, but existing connections go to old instance.
when all connections closed, close old instance.

I know this could be achieved by run a haproxy or nginx as reverse proxy, but docker use iptables NAT to redirect traffic to docker container, and iptables NAT will only match the first packet of a connection, then make following packet all NATed even rule have changed.
then seems there is no need to run a proxy which imports more complexity, just iptables and docker way can do it?


(Nathan Le Claire) #2

I think those kinds of reloads usually send a SIGHUP to the process to indicate config should be reloaded, right?

Could you use docker kill to send SIGHUP to the container?