Updating to latest Docker image - What's the best (automatic) update strategy?

Is it possible to always automatically update the Docker image to the latest version (I use nextcloud:stable)? Is there anything else to do besides the image update? Should one issue “occ upgrade” before updateing the docker image (or maybe after)? I guess not, because occ upgrade is part of entrypoint.sh in the Docker image.

What is the best strategy to automatically keep Nextcloud up to date?

1 Like

Generally for the update, if you’re not using any custom images, all that’s needed is:

docker compose pull
docker compose up -d

You can script it and put it in cron if you’re okay with the risks. You’ll periodically have to run a command or two in occ as prompted on the settings screen.

One other thing I would add is that you’ll start to get a pile-up of old Docker images. You can remove them with:

docker image prune

I don’t remember if that command might prompt for confirmation, so be sure to check when scripting.

Also, you may want to consider only auto-upgrading minor versions. If you change your tag to something like nextcloud:24 then it won’t upgrade to 25 until you update the config. That would give you a little more control over the major version upgrades.

Watchtower can keep it up to date for you. It runs in a container alongside other containers you wish to keep automatically updated.

And you’re correct that it is not necessary to manually run occ upgrade with your setup.