How to set a pre-existing docker container to start on boot


Sometimes I forget to set the --restart=always on docker containers that should be persistent. Fortunately for me the creators of docker anticipated my use case and provide a quick way for me to rectify the issue.

References

Solution

This really is just a one-line solution. I'm only making this post so I have muscle memory for where to reference the solution for this 'once-a-year' class of problem.

To set an existing container to always start:

  • docker update --restart=always

To set an existing container to stop starting on boot:

  • docker update --restart=no