Docker Nextcloud not started upgrade 18->20 now incompatible with 19

Nextcloud version: 18,19,20
Operating system and version: Debian Buster + Docker
Apache or nginx version: nginx
PHP version: 7.4?

The issue you are facing: After shortly operating my docker nextcloud service with a v20 image after using v18 before, but NOT upgrading, I now cannot start the docker service with a v19 image, as the logs say the data is already v20 and downgrading is not supported.

Can't start Nextcloud because the version of the data ( is higher than the docker image version ( and downgrading is not supported. Are you sure you have pulled the newest image version?

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Create docker nextcloud service running v18
  2. Start that service with nextcloud image v20
  3. disable maintenance mode in config.php
  4. review “upgrade now?” screen and choose to NOT upgrade
  5. start docker service again with nextcloud image v19
  6. observe error saying that data is already v20 format

Nextcloud log (messages from this month):

What steps should i take to “rescue” my nextcloud data / instance.

docker images don’t update via web interface. they have an update script build in.

so once you start a new image with a higher version it will update during startup.

i faced the same issue only a few weeks ago when updating from version 17 to 18 (accidentally used the nextcloud image 20). Nextcloud can’t be updated between different major versions. Instead you need to update from major version to next major version (18->19->20).
With each version database migrations are required and i guess that’s the reason. Although i don’t understand why not all migrations are executed sequentially. But maybe there are other reasons, too.
So when you start nextcloud with an new version an update is triggered and it fails if the major versions are too far apart. Sadly, nextcloud changes the version.php in the root directory with the new version. You need to start nextcloud with version 20 again, connect to the docker container and change the version in version.php. Additionally make sure that the config.php has the correct version as well, but this shouldn’t have changed.
Start nextcloud with version 18, see if it works, then change to nextcloud version 19 and execute the database migrations via the occ tool for example.
And if that works, try the same approach with version 20.


1 Like

Thanks Christian for that proposal. I was confident that it would work, but for me unfortunately it didn’t. I ended up with a broken v20 instance. Luckily I have some more or less recent backup of my docker volumes that I can restore do upgrade properly.


I have the same issue because nextcloud:latest in my docker-compose stack jumped from :18 to :20.

I ran into the same issue. Fixed it by first adding the :19 tag to my docker-compose.yml, ran:
docker-compose pull

Then manually extracted a 19.x tar.bz2 over the app volume. Find this by running:
docker container inspect nextclouddocker_app_1 #(or whatever your nextcloud container name is)
and looking for the volume with the destination of /var/www/html.

Had to do some permission corrections, create the custom_apps folder, and do a
restorecon -Rv.
Then run the upgrade:
docker exec -it -u www-data nextclouddocker_app_1 bash -c ‘./occ upgrade’
All fixed.