Dockerized Nextcloud upgrade always fails

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 22.0.0 -
Operating system and version (eg, Ubuntu 20.04): Linux 5.16.9-arch1-1 x86_64
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Debian) (apache2handler)
PHP version (eg, 7.4): 7.4.22

The issue you are facing:

  • attempting to update nextcloud always fails. I have downloaded all version above my current on with the intention of sequentially updgrading, but simply attempting to upgrade from → 22.1.0 fails. This has been several months of trying to figure this out on my own from the documentation, forums, repo issues, and random blog posts, but at this point i need some definitive instructions on what exactly the upgrade process steps should be.

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

Steps to replicate it:

  1. stop++remove containers
  2. replace nexctloud application folder with new version
  3. update version in config.php
  4. “compose up”
  5. put nextcloud in maintenance mode
  6. try to updgrade (have tried both ways, always after running through all the previous steps)
    6a. docker-compose exec -u www-data nextcloud-app php occ upgrade
  • this will complete successfully, but the web UI perpetually states I need to complete an upgrade
    6b. docker-compose exec -u www-data nextcloud-app php updater/updater.phar
  • this starts and immediately stops, none of the boxes get checked

The output of your Nextcloud log in Admin > Logging:

too large to paste;

pw: pHtLwgZ9Gn

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

$CONFIG = array (
  'trashbin_retention_obligation' => 'auto, 30',
  '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,
  'overwrite.cli.url' => 'overwrite.cli.url',
  'overwritehost' => 'overwritehost',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '',
  'overwritecondaddr' => 'overwriteconaddr',
  'instanceid' => 'instanceid',
  'passwordsalt' => 'passwordsalt',
  'secret' => 'secret',
  'trusted_domains' => 
  array (
    0 => 'localhost',
  'csrf.optout' => 
  array (
    0 => '/KeeWeb\\/\\d+\\.\\d+\\.\\d+/',
    1 => '/^WebDAVFS/',
    2 => '/^Microsoft-WebDAV-MiniRedir/',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => true,
  'loglevel' => 0,
  'dbname' => 'dbname',
  'dbhost' => 'dbhost:port',
  'dbuser' => 'dbuser',
  'dbpassword' => 'dbpassword',
  'mysql.utf8mb4' => true,
  'app_install_overwrite' => 
  array (
    0 => 'joplin',
    1 => 'announcementcenter',
    2 => 'files_retention',
    3 => 'keeweb',
    4 => 'bookmarks',
  'theme' => '',
  'has_rebuilt_cache' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'mail_from_address',
  'mail_domain' => 'mail_domain',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '465',
  'mail_smtphost' => 'smtphost',
  'mail_smtpname' => 'smtpname',
  'mail_smtppassword' => 'smtppassword',
  'trusted_proxies' => 
  array (
    0 => 'localhost',
  'mail_smtpsecure' => 'ssl',
  'onlyoffice' => 
  array (
    'DocumentServerUrl' => '/ds-vpath/',
    'DocumentServerInternalUrl' => 'documentserverinternalurl',
    'StorageUrl' => 'storageurl',
    'verify_peer_off' => true,
  'allow_local_remote_servers' => 'true',
  'default_phone_region' => 'US',

The output of your Apache/nginx/system log in /var/log/____:

You are trying the upgrade in a wrong way. Please follow the right update procedure for docker

This does not work. I originally had the latest nextcloud image set in my compose file, and this is what broke my installation originally and led me down the path of trying to manually upgrade that i saw all over the place because it tried to jump versions.

I tried this once more just now, and I am still stuck at this screen despite the upgrade “successfully” completing.

(this forum won’t upload an image successfully so here is the text of the web UI i encounter)

## Nextcloud will be updated to version 22.1.0

Please make sure that the database, the config folder and the data folder have been backed up before proceeding.

<em>To avoid timeouts with larger installations, you can instead run the following command from your installation directory:

./occ upgrade</em>

…(terminal output).
Update successful │
│ Turned off maintenance mode │
│ Resetting log level │
│ The following apps have been disabled: │
│ calendar │
│ circles │
│ [Wed Mar 09 10:10:20.080965 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.23 configured – resuming normal operations

it will stay this way unless i revert back to

:latest is never good choice - as you have no control about the version, I recommend defined version you change in a controlled way.

I updated my 2 instances without big issues over 3 major and multiple minor releases using official procedure… It takes time after the start of the container before it becomes available - because it’s upgrading all the installed apps. take some time… maybe try to restart the container or maybe only the Apache process docker exec nextcloud-app service apache2 reload

sounds wrong - official Nextcloud docker image uses PHP8 for NC22 and NC23

UPDATE: you should upgrade PHP to 7.4.28 at least due to CVE-2021-21708