Upgrade one major at a time with Docker

I have a perfectly working Nextcloud instance installed via docker-compose.
The docker-compose.yml file is the following:

version: '3'

    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
      - /my/db/location:/var/lib/mysql
      - MYSQL_ROOT_PASSWORD=my_password
      - db.env

    image: nextcloud:apache
    restart: always
      - /my/nextcloud/location:/var/www/html
      - MYSQL_HOST=db
      - VIRTUAL_HOST=my_virtual_host
      - LETSENCRYPT_HOST=my_host
      - LETSENCRYPT_EMAIL=my_email
      - db.env
      - db
      - proxy-tier
      - default


    external: true

From the overview section in the Admin account, the current version appears to be 16.0.3.
The overview section also prompts me to update to version 16.0.8.

However, I would like to upgrade to Nextcloud 18, but the documentation explicitly says that upgrades between two or more major versions are not supported.

Given that I’m really ignorant about docker, the problem is that I cannot find anywhere how should I upgrade to version 17 first, and then to 18.
First of all, the docker-compose.yml doesn’t seem to contain any information about the current version, and I cannot find any information about specifying a particular version for docker-compose to pull in general.

I suppose that should exist a way to specify a precise version in the “image:” line, but I can’t figure out how.

What I have to do in order to upgrade to Nextcloud 17 avoiding the last version until I have completed the first upgrade?



I would login to the nextcloud instance as admin (ncp) and go to settings > overview and from there upgrade to NC 17 and then NC 18.

Thanks for you answer. From the overview settings I only see the option to upgrade to version 16.0.8. Should I switch to Beta channel to see new versions? In any case, trying with 16.0.8 it start a download from the browser for an archive with the new release. I thought that the upgrade could have been made through docker-compose directly. Isn’t it possible?

I have switched to Beta and now Nextcloud 17 is the latest release. Probably the 18 update has not been rolled out for me yet. However, clicking “Open Updater” brings me to the files section, but no updater is shown. How should I do this? Can i download the zip instead and put it in the files folder of the docker installation? Would that work or is intended only for manual installations without docker?

Anyway, I would be glad if this could be controlled by pulling a specific version with docker.

I wouldn’t switch to beta. You have to update to the latest on NC 16 in order to see the next major update. So you update to 16.0.8 first and then you will see 17 and then 18. I’m running Nextcloudpi docker container and that’s how I updated…

And as far as I know, if you switch to beta you can’t switch back to stable anymore…

Ok, thanks, that’s useful information. I’m in fact trying to install version 16.0.8. The question is: how should I do that? I’ve tried replacing the files in the folder mapped to /var/www/html with the ones in the .zip downloaded from the overview section, but it doesn’t work, the browser says “Bad gateway” (I’ve installed nextcloud behind an nginx reverse proxy).

Now i put back the original files and the previous version started working again.

Normally you shouldn’t have to do anything other then clicking to ‘Open updater’ which should launch updater and download and update everything and reboot automatically…

That is what I imagined too. Unfortunately it brings me to the files section and nothing happens. By the way, are you sure this method works for docker installations too? in the docker page of nextcloud only talks about pulling new docker versions by the command line.

This is where my knowledge ends I guess. I’m running a NextcloudPi docker container. This is what I followed:


I like the extra options of NCP and the backup solution works very well which is very important to me…

nope. not with docker.

edit your docker compose and use a “version tag”. e.g. nextcloud:17-apache for your image.
stop, start. edit -> nextcloud:18-apache. stop. start.

well. try docker inspect <image-name> to get the needed info to recreate/update your docker compose file.

Also with NextcloudPi docker image?

There is not much info on the official link I followed: https://docs.nextcloudpi.com/en/how-to-get-started-with-ncp-docker/

It executes ncp-update command in the container but no info on instance update so I assume instance update has to be done from within the nextcloudpi app (localhost:4443) which is same as updating with admin from the instance…

you are right. that one is different.

but that’s the “normal” nextcloud image. or?

That is exactly what I meant! Is that just an example or is actually working with nextcloud?
Also, is there a way to search with docker to get a list of the possible versions existent for a specified container?

Yes, it’s the default image, but it doesn’t specify wich version of nextcloud (16,17,18) it should pull. I suppose it’s normal, but my lack of knowledge leaves me wondering how say to the docker-compose “Pull version 17 instead of the last” when executing

sudo docker-compose pull

I hope my doubt is clear.


I used

image: nextcloud:17-apache

in the docker-compose.yml file, like @Reiner_Nippes suggested, and it worked like a charm! It pulled nextcloud 17 and it opened already updated without any updater prompt (not like with manual installations updates).

Thank you very much!!! I will mark your answer as the correct solution!

you’ll find the update mechanism in the entrypoint.sh

which version is packed in the image you’ll find in the dockerfile.

to find all available tags you can use the docker website


or use the docker api


Thank you very much! You helped me a lot!

I saw the various tags on Docker Hub. However the tags are not something that is necessarily adopted by the various dockers, am I right? Looking for example at the GitLab dockers, there is no tags section.

Is it something that Nextcloud decided to use for its docker but not taken for granted with every docker?

first of all there is a docker command to tag an image

and to push it to a docker registry

you can address images by this tags. that’s “normal” docker behavior.

if people are tagging their images depends on the people.

build your own private images you might not care because you always want to use latest. providing official image like nextcloud is doing it’s very nice to tag your images. all major vendor do tagging right. otherwise you would know whichversion you are using and how to upgrade.

btw: upgrade. please note that tags are not always pointing to the same image. e.g.: nextcloud:apache is always the latest version with apache. nextcloud:18-apache will always be the latest major version 18. and nextcloud:18.0-apache will pin your image to the lastest 18.0.

that’s quite usefull if you use “auto update”. have look at


Many thanks for your detailed answers, you cleared all my doubts!