The v5 to v6 guide suggests a fresh setup for database apps. This page is for you if you know some Docker and want to keep your data in Nextcloud, Immich or Paperless-ngx. It replaces Step 8 of that guide for these three apps.
Before you start
Section titled “Before you start”- You follow the v5 to v6 guide: you did its backup and rename steps (Steps 2 and 3, so your v5 folder is
docker-v5), and v6 and its core apps run (Steps 5 and 6). - You have a few hours where these apps can be down.
In the commands, replace USERNAME with your Linux user name. The commands assume your Docker folder is /home/USERNAME/docker. Change the path if yours is somewhere else.
How the move works
Section titled “How the move works”- Immich: you copy its v5 database folder into v6 and reuse it.
- Nextcloud and Paperless-ngx: v5 kept their data in one shared MariaDB. v6 gives each its own. You export the database from v5 and import it into the new one.
The export needs the v5 MariaDB running. So do Part 1 before Step 1 of the move guide, while v5 is still up. If you use only Immich, skip Part 1.
Part 1: Export in v5 (Nextcloud and Paperless-ngx)
Section titled “Part 1: Export in v5 (Nextcloud and Paperless-ngx)”-
For Nextcloud, turn on maintenance mode:
Terminal window sudo docker exec -u www-data nextcloud php occ maintenance:mode --on -
Stop the apps. Leave
mariadbrunning:Terminal window sudo docker stop nextcloud paperless-ngx -
Export the Nextcloud database:
Terminal window sudo docker exec mariadb sh -c 'exec mariadb-dump -u root -p"$(cat /run/secrets/mariadb_root_password)" --single-transaction nextcloud' > /home/USERNAME/nextcloud-v5.sql -
Export the Paperless-ngx database:
Terminal window sudo docker exec mariadb sh -c 'exec mariadb-dump -u root -p"$(cat /run/secrets/mariadb_root_password)" --single-transaction paperless' > /home/USERNAME/paperless-v5.sql -
Check that the files have a size and are complete:
Terminal window ls -lh /home/USERNAME/*-v5.sqltail -n 1 /home/USERNAME/nextcloud-v5.sqlThe last line should say
-- Dump completed. Check the Paperless-ngx file the same way. -
Go on with the v5 to v6 guide from Step 1. Come back here after its Step 6.
Already stopped v5?
Section titled “Already stopped v5?”You can still export. Copy the v5 MariaDB data and start a throwaway MariaDB on the copy:
sudo cp -a /home/USERNAME/docker-v5/appdata/mariadb/data /home/USERNAME/v5-mariadb-copysudo docker run -d --name v5-mariadb -v /home/USERNAME/v5-mariadb-copy:/var/lib/mysql mariadb:latestWait about 30 seconds. Then export each database. This is the Nextcloud one. For Paperless-ngx, use paperless and paperless-v5.sql:
sudo docker exec -e MYSQL_PWD="$(sudo cat /home/USERNAME/docker-v5/secrets/mariadb_root_password)" v5-mariadb mariadb-dump -u root --single-transaction nextcloud > /home/USERNAME/nextcloud-v5.sqlCheck the files as in step 5 above. Then remove the throwaway copy:
sudo docker rm -f v5-mariadbsudo rm -rf /home/USERNAME/v5-mariadb-copyPart 2: Import in v6
Section titled “Part 2: Import in v6”Install the app first
Section titled “Install the app first”Do this for each app you move.
- Open System > Folders and set Immich Folder or Nextcloud Folder to a new, empty folder. This keeps the fresh install from writing into your old uploads. See Folders. Skip this for Paperless-ngx.
- Install the app from Apps > Browse Apps.
- Wait until the app runs.
Then follow the section for your app. Stop only the app, not its database, unless the steps say so. Use the bash aliases dcrec and dlogs, or Tools > Stack Manager > Recreate (needs a Basic, Plus or Pro license).
Immich
Section titled “Immich”-
Stop Immich and its database:
Terminal window sudo docker stop immich immich-postgresql -
Set the new database folder aside, then copy the v5 one in:
Terminal window sudo mv /home/USERNAME/docker/appdata/immich-postgresql /home/USERNAME/docker/appdata/immich-postgresql.newsudo cp -a /home/USERNAME/docker-v5/appdata/immich-db /home/USERNAME/docker/appdata/immich-postgresql -
Look up your v5 database password:
Terminal window grep IMMICHDB_POSTGRESQL_PASSWORD /home/USERNAME/docker-v5/.env -
Put that value into
IMMICH_POSTGRESQL_PASSWORDin the v6.env. Use Tools > .env Editor or edit the file by hand. See Edit .env values and secrets. The old database keeps the password it was created with, so v6 must use the same one. -
Open System > Folders and set Immich Folder to your v5 upload folder. It is the
IMMICH_FOLDERvalue indocker-v5/.env. -
Recreate the database, then Immich, and watch the logs:
Terminal window dcrec immich-postgresqldcrec immichdlogs immichThe first start can take a while. Immich moves your old search index to its new format and upgrades from v5’s Immich version. Wait until the logs settle.
Nextcloud
Section titled “Nextcloud”-
Stop Nextcloud:
Terminal window sudo docker stop nextcloud -
Empty the new database:
Terminal window sudo docker exec -i nextcloud-mariadb sh -c 'exec mariadb -u root -p"$(cat /run/secrets/nextcloud_mariadb_root_password)"' <<'EOF'DROP DATABASE nextcloud;CREATE DATABASE nextcloud;EOF -
Import your v5 export:
Terminal window sudo docker exec -i nextcloud-mariadb sh -c 'exec mariadb -u root -p"$(cat /run/secrets/nextcloud_mariadb_root_password)" nextcloud' < /home/USERNAME/nextcloud-v5.sql -
Replace the app files with the v5 ones. Check the paths before you press Enter.
rm -rfdeletes without asking:Terminal window sudo rm -rf /home/USERNAME/docker/appdata/nextcloudsudo cp -a /home/USERNAME/docker-v5/appdata/nextcloud /home/USERNAME/docker/appdata/nextcloud -
Back up
config.php, show the v6 database password, and openconfig.phpin an editor:Terminal window sudo cp /home/USERNAME/docker/appdata/nextcloud/config/config.php /home/USERNAME/docker/appdata/nextcloud/config/config.php.baksudo cat /home/USERNAME/docker/secrets/nextcloud_mariadb_passwordsudo nano /home/USERNAME/docker/appdata/nextcloud/config/config.php -
Set these three values. For
dbpassword, use the password the second command showed:'dbhost' => 'nextcloud-mariadb','dbuser' => 'nextcloud_db_user','dbpassword' => 'V6_PASSWORD', -
Open System > Folders and set Nextcloud Folder to your v5 data folder. It is the
NEXTCLOUD_FOLDERvalue indocker-v5/.env. -
Recreate Nextcloud and watch the logs. If the v6 image is newer, Nextcloud upgrades itself on start. Wait for it to finish.
Terminal window dcrec nextclouddlogs nextcloud -
Turn maintenance mode off:
Terminal window sudo docker exec -u www-data nextcloud php occ maintenance:mode --off
Paperless-ngx
Section titled “Paperless-ngx”-
Stop Paperless-ngx:
Terminal window sudo docker stop paperless-ngx -
Empty the new database. The single quotes make the container use its own root password:
Terminal window sudo docker exec -i paperless-ngx-mariadb sh -c 'exec mariadb -u root -p"$MARIADB_ROOT_PASSWORD"' <<'EOF'DROP DATABASE paperless;CREATE DATABASE paperless;EOF -
Import your v5 export:
Terminal window sudo docker exec -i paperless-ngx-mariadb sh -c 'exec mariadb -u root -p"$MARIADB_ROOT_PASSWORD" paperless' < /home/USERNAME/paperless-v5.sql -
Replace the app files. The folder layout is the same in v5 and v6. Check the paths before you press Enter:
Terminal window sudo rm -rf /home/USERNAME/docker/appdata/paperless-ngxsudo cp -a /home/USERNAME/docker-v5/appdata/paperless-ngx /home/USERNAME/docker/appdata/paperless-ngx -
Recreate the app and watch the logs:
Terminal window dcrec paperless-ngxdlogs paperless-ngxv6 gives Paperless-ngx a new secret key, so you have to sign in again in every browser.
Check it worked
Section titled “Check it worked”- Open the app and sign in with your v5 account. Nextcloud and Paperless-ngx take their users from the imported database. Paperless-ngx may also add the admin from the v6 install again if that name is not in the v5 data.
- Check that your files, photos or documents are there.
- Read the logs. They should have no
Access denied for userorpassword authentication failedlines. - When you are sure, delete the leftovers: the
.sqlfiles,immich-postgresql.newand the empty folders you made for the install. Keepdocker-v5until every app in the move guide works.
Troubleshooting
Section titled “Troubleshooting”Access denied for user, or password authentication failed
Section titled “Access denied for user, or password authentication failed”The password in config.php or .env does not match the database. Recheck the value you copied. See Change a database password safely.
The import prints errors
Section titled “The import prints errors”The export file is empty or cut off. Make it again and check that it ends with -- Dump completed.
Other database apps
Section titled “Other database apps”This page does not cover the other database apps listed in the move guide. Set them up fresh, or ask on Discord.

