Nextcloud, Docker, and upgrades

I have been running Nextcloud via a Docker image for a few months and recently a new version of Nextcloud was released. This seemed like the perfect opportunity to test out upgrading to a newer Nextcloud Docker image and keeping my data. Since I mount a volume to keep the configuration data in, it will be a fairly easy to upgrade.

First step is to make sure we have backups and verify their integrity. The Nextcloud backups page details these instructions pretty well, but just to cover the basics you need to backup your data and database at a minimum. I also went ahead and grabbed a copy of the config.php by itself and stored it outside of the container. Tip: I didn’t initially know which volume store was the right one, so I entered the container by loading bash and created a temporary file named ‘findmehere’ that I could search for from the host.

Next we will stop the existing container by issuing a ‘docker stop <id>’ where <id> is the container id listed in the output of ‘docker ps’. Then we will start a new docker image using the same command we did the first time. For me this looked like ‘docker run -d -v nextcloud:/var/www/html -p 8181:80 nextcloud’ but YMMV.

The occ script should detect the new version of Nextcloud and start the upgrade. Check the status by visiting your Nextcloud web page. Since we used a volume to keep our data in we should be all set!