How can I transfer my complete Nextcloud instance from a NextcloudPi docker container to the official docker container?

For a few years now I’ve been running a Nextcloud instance using NextcloudPi’s docker container. At the time it seemed like the easiest way to get Nextcloud up and running.

However it’s been a support nightmare. Every time I try to update NextcloudPi or Nextcloud itself, something goes wrong and it takes me hours to sort out. I’ve got none of the advantages of using a Docker container with this, and I now realize that it doesn’t make sense to use NextcloudPi in a docker container when I could just be running the official Nextcloud docker image and updating by pulling the latest container. I’d like to make the switch.

However, I have no idea how to transfer everything from one to the other!

How can I transfer my complete Nextcloud installation, including users, settings, apps, and files, from a NextcloudPi docker container to the official Nextcloud docker?

To make this more complicated, because updating has been broken for so long, I am still running Nextcloud 19.

Well, it appears that I’ve done it. It took several hours of work and a lot of problem solving, but I seem to have transferred all of my files to a new Nextcloud instance running in the official docker container, and all of my public links still work.

I ended up using NCP’s backup feature to make a backup of the entire instance, including data. Then I spun up a fresh NC instance using version 19.x of the official docker container and a container for mariadb using docker-compose. Once that was done, I added the folder containing NCP’s backup tar file to both containers.

For the database, I followed the directions for restoring a nextcloud instance and dropped the existing table and then imported the backup in the tar file.

For the NC instance, what I found is that copying the contents of the data directory but not the contents of the root nextcloud directory seemed to work. Once that was done, I needed to tweak config.php a bit to get it right, but then I had a working Nextcloud installation.

There were a few other snags I hit:

  • Two factor authentication stopped working for all of my user accounts. Fortunately I could log in using a backup code, which was still working. I needed to disable then re-enable 2FA for all of them in order to get them working again.

  • The size of the backup I made was about 2-3 times larger than it needed to be because Nextcloud was holding on to a lot of deleted files. Things would’ve gone faster if I had cleared those out first!

1 Like