Published on

Automatically start docker container on system boot

Author
  • Name
    A. Fauzi
    Title
    Human Being

Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts. Restart policies ensure that linked containers are started in the correct order. Docker recommends that you use restart policies, and avoid using process managers to start containers.

To configure the restart policy for a container, use the --restart flag when using the docker run command. The value of the --restart flag can be any of the following:

docker-restart-policy.png

So if you want to automatically start a container when you turned on your computer or when you start Docker, you can use the following command:

$ ⁠docker update --restart always <container name>

Reference:
Start containers automatically