Nextcloud in Docker never installs update from newer image

Nextcloud version (eg, 20.0.5): 22.2.5-fpm (Docker)
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Caddy 2

The issue you are facing:

The title says it all–I’ve been trying in vain to upgrade my Nextcloud install, which is currently running in a Docker container. Setup uses the full Dockerfile in the examples folder from the official GitHub repo, modified only to remove a few unneeded packages, and it’s been working perfectly… but it’s impossible to update. Removing the old container and images, updating the Dockerfile and docker-compose.yml, and pulling and building a new image does absolutely nothing–both the CLI and the front end still report the same version number.

If I run docker exec -u www-data -w /var/www/nextcloud nextcloud php occ status, I get the following:

  - version: 22.2.5.1
  - versionstring: 22.2.5

If I run update:check, the CLI informs me that there is an update available. Running upgrade gets me a response of Nextcloud is already latest version.

Running config:list appears to offer a clue–version is, as ever, stuck on 22.2.5.1, but lastupdateResult does make reference to a newer version that isn’t otherwise being detected:

{\"version\":\"22.2.6.2\",\"versionstring\":\"Nextcloud 22.2.6\",\"url\":\"https:\\\/\\\/download.nextcloud.com\\\/server\\\/releases\\\/nextcloud-22.2.6.zip\",\"web\":\"https:\\\/\\\/docs.nextcloud.com\\\/server\\\/22\\\/admin_manual\\\/maintenance\\\/upgrade.html\",\"changes\":\"https:\\\/\\\/updates.nextcloud.com\\\/changelog_server\\\/?version=22.2.6\",\"autoupdater\":\"1\",\"eol\":\"0\"}

Is there any way to safely overwrite or delete this data and force a new update to the container? And how might I prevent this from happening again the next time there’s an update? Simply following the update instructions clearly hasn’t worked for me, and I haven’t found any useful information searching on the web.

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

Steps to replicate it:

  1. Stop outdated Nextcloud Docker container
  2. Remove container and delete any old Nextcloud images
  3. docker compose build --pull and docker compose up -d
  4. Docker will pull new image and build from Dockerfile, but php occ still shows old version number

Updating to confirm that the lastupdateResult “clue” is actually nothing. This just seems to show the result of the last background update, not an upgrade process, as setting it to an empty array cause Nextcloud to report that it’s fully up-to-date until the update notifications app is refreshed.

Attempting to change the version number with config:system:set to 22.2.6.2 and run occ upgrade triggers an exception where Nextcloud complains about being downgraded from 22.2.5.1 to 22.2.6.2 (?). This state is not reversible from the command line–the only way to return NC to a functional state is to completely stop the container and edit config.php.

I’m running out of ideas–any suggestions would be much appreciated.

official Docker upgrade path consists of building new container from respective image. for this reason I was under impression the version is included in the dockerfile, but this is not the case. It comes from the ENV variable ${NEXTCLOUD_VERSION} but I don’t see yet where this var is populated. I think you need to double check your evironment… docker inspect might help.