一般情形下,通過
docker pull nextcloud
可以獲取到最新的nextcloud容器鏡像,然後nextcloud會自行更新到最新版本。
由於我使用了一段時間nextcloud應該是在16這個版本,然後直接pull下來了18版本。此時,發現我的nextcloud無法打開,出現如下錯誤:
Initializing nextcloud 18.0.1.3 ...
Upgrading nextcloud from 16.0.0.9 ...
Initializing finished
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Turned on maintenance mode
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Reset log level
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.3. Set the 'ServerName' directive globally to suppress this message
[Mon Feb 17 19:37:10.137612 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.14 configured -- resuming normal operations
[Mon Feb 17 19:37:10.137666 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Mon Feb 17 19:37:12.460440 2020] [autoindex:error] [pid 30] [client 172.22.0.1:60460] AH01276: Cannot serve directory /var/www/html/apps/files/: No matching DirectoryIndex (index.php,in dex.html) found, and server-generated directory index forbidden by Options directive
通過以下命令,查詢到相關的版本
docker exec --user www-data nc php /var/www/html/occ status
結果
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
- installed: true
- version: 18.0.1.3
- versionstring: 18.0.1
- edition:
通過以下命令進行升級
docker exec --user www-data nc php /var/www/html/occ upgrade
結果
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Turned on maintenance mode
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Reset log level
發現不允許升級。
以下高能到來,強制進行升級 參考鏈接
修改以下這個文件 nextcloud/lib/private/Updater.php
修改保存之後,再次通過以下命令就可以升級
docker exec --user www-data nc php /var/www/html/occ upgrade
等待升級完成之後,使用以下命令關閉維護模式
docker exec --user www-data nc php /var/www/html/occ maintenance:mode --off
結果
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled
完成以上步驟之後,重新打開網頁即可進入到Nextcloud裏面。
一句話忠告:儘量不要誇太多版本升級,否則會出現太多的異常無法解決。