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

Fatal error: Uncaught Whoops\Exception\ErrorException: session_write_close(): write failed: No space left on device (28) in Unknown:0 Stack trace: #0 /var/www/html/system/src/Grav/Common/Debugger.php(847): Whoops\Run->handleError(2, 'session_write_c...', 'Unknown', 0) #1 [internal function]: Grav\Common\Debugger->deprecatedErrorHandler(2, 'session_write_c...', 'Unknown', 0, NULL) #2 [internal function]: session_write_close() #3 {main} thrown in Unknown on line 0