Updating the Linuxserver Nextcloud Docker Container

Some Docker images are somewhat unique in that you don’t update containers by simply updating the image.

More precisely, I should say that you still update the containers just like you update any Docker image, but these images won’t update their application binaries if they’re already installed. Technically, this is simply because the applications are stored in a bind mount outside of the container, but more accurately, there’s a reason this is done. You tend to see this in containers that rely on databases (Nextcloud, Plex Media Server, etc.) since the data in a database is intrinsically tied to that version of the database. When you update the database code, you usually can’t simply leave the stored database itself alone in a vacuum and update the code alone. You have to update the database binaries and then run a migration so that the database works with the new version. Django developers are likely familiar with this.

Linuxserver.io’s Nextcloud Docker image is one such instance and I always have to look up the update procedure.

To save myself some time in the future, I am outlining the procedure for updating the Linuxserver Nextcloud instance:

  1. From the host, run the following command:
    docker exec -it nextcloud updater.phar

  2. You’ll be given a list of “Steps that will be executed” followed by a prompt to “Continue update?”, answer “y”.

  3. The update steps will run, followed (hopefully) by “Update of code successful”. You’ll then be prompted with, “Should the “occ upgrade” command be executed? [Y/n]”, respond to the prompt with “Y” to continue the update.

  4. The upgrade will continue on and upon completion, you’ll receive a final prompt, “Keep maintenance mode active? [y/N]”. Answer “N” to disable maintenance mode and bring your Nextcloud deployment back up for use.

Don’t even bother with the GUI update from Nextcloud itself. It almost always fails and you’ll have to do the above steps to fix it anyway.