wiki:Docker HowTo Auto Start Containers On Reboot

Docker HowTo Auto Start Containers On Reboot

An explanation for systemd as a process manager can be found at :

Once you are happy with your docker images and container, you must us systemd to restart them.

  1. Go to the directory :


This directory contains all .service files that are used to start docker containers.

  1. Check what docker services are enabled on start up

systemctl list-unit-files | grep docker

This will list out all the services that are enabled.

  1. To create a new service called docker-[containername].service :

sudo vi /etc/systemd/system/docker-[containername].service

add the contents similar to the following, but change Description ExecStart ExecStop :


Description=Redcap 6.16.8 container





ExecStart=/usr/bin/docker run -v /share:/share -itd -p 82:80 lcbruit/redcap_upgrade:v6.16.8

ExecStop=/usr/bin/docker stop -t 2 lcbruit/redcap_upgrade:v6.16.8


  1. If you have a new container build modify the content of this file.
  1. To activate the service run the following commands (rename service name) :

systemctl daemon-reload

systemctl start docker-redcap_6.16.8.service

systemctl enable docker-redcap_6.16.8.service

  1. To disable a service run the following commands (rename service name) :

systemctl stop docker-redcap_6.16.8.service

systemctl disable docker-redcap_6.16.8.service

  1. Change will only come to effect on a reboot

sudo reboot

Last modified 8 years ago Last modified on 10/06/16 16:14:57
Note: See TracWiki for help on using the wiki.