Ubuntu – Start Docker Container Automatically On Boot

dockerUbuntu

So I have a docker container named "webby" that I am trying to start on reboot. My host system is: Linux docker01 3.13.0-52-generic #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I added the following to /etc/default/docker:

DOCKER_OPTS="-r=true"

I made sure my container was started before rebooting. However after rebooting the container was not started.

I then tried to create an init script at /etc/init/scott.conf

description "Docker startup script for webby"
author "me"
start on filesystem and started docker.io
stop on runlevel [!2345]
respawn
script
  /usr/bin/docker start -a webby
end script

However after a reboot that doesn't start the container either. Any ideas what I am doing wrong?

Best Answer

I could never go the DOCKER_OPTS to work. However if I changed

start on filesystem and started docker.io

to

start on filesystem and started docker

Lots of old docker documentation out there.

Related Topic