How to Automatically Restart NCP Docker

Docker is a useful tool, but you might have a power outage and find NextcloudPi doesn’t restart. Let’s fix this.

$ docker ps -a
stopped or exited

Option 1. Automatically Restart NextcloudPi Docker

You can just update your already configured container (nextcloudpi) since this option is missing from the original run command.

$ docker update nextcloudpi --restart=unless-stopped

Now restart your device and you’ll find your NextcloudPi will automatically restart, unless you manually stopped it yourself. You can learn more about restarting Docker containers here.

Option 2. Automatically restart Docker-engine itself

Perhaps you find Docker-engine (docker the program) is what does not automatically restart. I’ve got you bro!

$ systemctl list-unit-files | grep docker

Enabled means it is working. If status isDisabled

$ systemctl enable docker.service

About the Author

This article was written by @just. Thank you so much for all you do! You may write your own articles by joining our wiki and documentation team on the forum.