[Solved] How to recover from an accidental "update"?

I accidentally pulled & ran a the nextcloud docker image for version 17, while I was using 15 before. Now I’m stuck in maintenance mode and occ refuses to run any commands. Running with image version 15 or 16 doesn’t work, because version.php is already at 17. Is there any way I can recover from this? I’d be willing to upgrade to 17.

I managed to fix it on my own by looking at the entry point script of the docker image:

docker run -u www-data nextcloud:fpm-alpine ash
rm /var/www/html/version.php
rsync -rlD --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
./occ upgrade

This copies the “old” files from version 15 over the new files that were copied by the entry point script of the version 17 Docker image.

The ./occ upgrade brought me out of the maintenance mode, since ./occ maintanence:mode --off by itself did not work.

I hope this post helps some future poor, unattentive soul who pulled the wrong Docker image.