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
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 is
$ systemctl enable docker.service