Docker Community Forums

Share and learn in the Docker community.

Restart=Always on Docker Demon explained


(Mike Kimber) #1

We are upgrading to Docker 18.06.2.ce (most recent compatible version with Rancher 1.6) and our “inspec” tests have noticed that the out of the box restart behaviour in /usr/lib/systemd/system/docker.service has changed from “Restart=always” to “Restart=on-failure” (seems to change back in later releases).

As part of our install process we are changing back to “Restart=always”; however, when we test this we do not seem to get the behaviour we expect

  • Shutdown the docker demon cleanly ( sudo systemctl stop docker i.e. exit code zero ) . The Demon is not restarted and we are expecting it to be with Always
  • Docker Demon fails badly (sudo kill -SIGTERM 21972 ). This works and restarts the demon
  • Docker Demon time out (sudo kill -SIGSTOP 2208). This seems to do nothing, we expected it to restart the demon after X period of time

There is a lot of documentation on restart policies for docker instances, but we are struggling to find the relevant documentation on how the docker demon should function and how we can test that it does in fact work the way we want.

Any help with this greatly appreciated.

Thanks Mike

[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=always
RestartSec=2
StartLimitBurst=3
StartLimitInterval=60s


(Mike Kimber) #2

The silence would suggest that it does not Honour Restart=always and I suspect the majority of Docker users are blissfully unaware.


(Mike Kimber) #3

See Should systemctl stop honour Restart=always?