For those who have been facing the “Maintenance mode active” after applied a nextcloud upgrade by switching container image version, due a major versioning issue.

Even when you issue the occ upgrade into continer you gets hit by something like below:


www-data@87401bdd2fa8:~/html$ php /var/www/html/occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Resetting log level

Keep a eye on this part: Updates between multiple major versions and downgrades are unsupported. as I was running 25 version I can no jump for above 27, if that’s our case, we can edit the file app/config/config.php edit the version of your nextcloud like below:

...
'version' => '27.0.0.8',
...

From the example above I changed 25 to 27.

Then I downloaded the latest image and restarted my docker-compose

docker pull nextcloud:27.0.0-apache
docker-compose down
docker-compose up -d --force-recreate

Hope it can be useful