Docker containers not restarted on reboot

193 views
Skip to first unread message

Kevin Heatwole

unread,
Nov 7, 2016, 8:24:47 AM11/7/16
to CoreOS User
I'm using the latest Alpha Channel release running in an OpenStack VM. I run a dozen or so Docker containers per VM with the --restart=always option. I've noticed that whenever CoreOS reboots (maybe because of updating to a new CoreOS release), the containers on the host do not restart, until I ssh in and do a 'docker ps'. The 'docker ps' waits a few seconds and then shows all containers as running (up less than a few seconds).

I need to get this fixed (either in Docker or in CoreOS) as reboots can happen in production and I don't want my site to go down until I run a Docker command. I suppose I can work-around this problem by having a cron-job run every minute doing 'docker ps' (I haven't tried this yet so not sure if this would really work in production).

Alex Crawford

unread,
Nov 7, 2016, 11:50:37 AM11/7/16
to Kevin Heatwole, CoreOS User
On 11/07, Kevin Heatwole wrote:
> I'm using the latest Alpha Channel release running in an OpenStack VM. I
> run a dozen or so Docker containers per VM with the --restart=always
> option. I've noticed that whenever CoreOS reboots (maybe because of
> updating to a new CoreOS release), the containers on the host do not
> restart, until I ssh in and do a 'docker ps'. The 'docker ps' waits a few
> seconds and then shows all containers as running (up less than a few
> seconds).

Docker doesn't run by default on CoreOS Linux, but is socket-activated.
This is why running `docker ps` starts up all of your containers. If you
want it to run automatically, you just need to enable it:

systemctl enable docker.service

You can also use Ignition to set this up when you provision the VM:

{
"ignition": { "version": "2.0.0" },
"systemd": {
"units": [{
"name": "docker.service",
"enable": "true"
}]
}
}

I hope that helps.

-Alex
signature.asc

Kevin Heatwole

unread,
Nov 7, 2016, 12:28:58 PM11/7/16
to CoreOS User, ktwa...@gmail.com
Thanks. It is working now as expected.
Reply all
Reply to author
Forward
0 new messages