Docker upgrade (25.0.3 -> 25.0.12) with /var/www/html/ in a volume

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): Debian 11.6
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 8.1.16

The issue you are facing: After upgrading to the latest docker image, I am getting an error message “This version of Nextcloud is not compatible with PHP>=8.2.”.

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

Steps to replicate it:

  • docker stop my_cloud
  • docker rm my_cloud
  • docker pull nextcloud:latest
  • docker create --name my_cloud --volume $ROOT/html/:/var/www/html/ nextcloud:latest
  • docker start

The output of your Nextcloud log in Admin > Logging: N/A - Can’t get into the web interface.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
  'instanceid' => 'some_id',
  'passwordsalt' => 'some_salt',
  'secret' => 'some_secret',
  'trusted_domains' =>
  array (
    0 => 'my_domain',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://my_domain',
  'installed' => true,
  'default_phone_region' => 'us',
  'maintenance' => false,
  'dbname' => 'my_cloud',
  'dbhost' => 'mysql',
  'dbuser' => 'cloud_user',
  'dbpassword' => 'NotTheRealPass',
  'mysql.utf8mb4' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'support',
  'mail_domain' => 'my_domain',
  'mail_smtphost' => 'smtp.my_domain',
  'mail_smtpport' => '587',
  'simpleSignUpLink.shown' => false,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  'twofactor_enforced_excluded_groups' =>
  array (
    0 => 'admin',
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => 'some_secret',

I tried to recreate our docker container which has /var/www/html/ mounted to a local directory. It looks like creating the container from the latest image updated everything but the data in the volume, which I believe to be expected docker behavior. As a result, it looks like I got a new version of PHP, without actually having updated Nextcloud itself.

Next time I tried to connect to Nextcloud, I got an error message: “This version of Nextcloud is not compatible with PHP>=8.2.”.

What is the correct approach to upgrading a container that has all of /var/www/html/ in a volume?


hi @juergen_c welcome to the forum :handshake:

looks you tried an upgrade from nc25 to nc27 (which is ":latest" tag now)

you must not do this: never ever use :latest tag - always use a version and upgrade one major version at time! Take a look at this post you need recovery help and then follow Docker upgrade procedure

Thank you for your answer.

So, in my case, the correct thing would have been docker pull nextcloud:25.0.12, since I only want to update within version 25, correct?

The upgrade procedure says to use docker pull nextcloud which I thought was synonymous with docker pull nextcloud:latest.

The fact that /var/www/html/ is in a volume is not going to be an issue?


Answering myself here. I tried a slightly different approach:

    docker stop my_cloud
    docker rm my_cloud
    docker pull nextcloud:26.0.7
    docker create --name my_cloud_new --volume $ROOT/html/:/var/www/html/ nextcloud:26.0.7
    docker start my_cloud_new

Got the same error message (“This version of Nextcloud is not compatible with PHP>=8.2.”).

Tried a docker start my_cloud - that worked, and got me back to 25.0.3.

I don’t fully understand how running a newer image is going to update the application if all the files that make up the application are in a local volume.


glad you got the system running again.

as you mount the volume into container the application has access to the volume… the only difference is (persistent) remain on the hosts file system even after the container is destroyed…

I definitely would recommend to upgrade further… but as long nc25 remains supported you can stay on this version…

you are sharing the volume with data between different containers my_cloud and my_cloud_new which could result in unexpected results… I would recommend you copy the volume once you are going to create new container… and remove the original once your migration is successful.

Thank you for your patience.

I did end up going all the way to 27.1.2, but I was completely unable to do so by just recreating the container.

What I ended up doing was to update the application files in /var/www/html/ using the web based updater, and then ditching and recreating the container (docker pull nextcloud:27.1.2 - no more nextcloud:stable / nextcloud:latest for me - at least I’ve learned that lesson).

There is definitely something screwy with my setup - otherwise this extra step would not have been necessary - but at least it is working now.