The Docker version of NextCloud will not update via browser, it says “Please update using the command line updater.” is displayed. I found a workaround for not being able to update via browser on the official websites of NextCloud and NextCloud for Docker, so I will actually try it.
https://hub.docker.com/_/nextcloud/
docker exec --user www-data CONTAINER_ID php occ
The docker exec --user www-data CONTAINER_ID php occ
command allows you to perform various operations via NextCloud’s occ
command line tool. When this command is executed, a list of available commands is displayed. This is a very useful feature when performing NextCloud administration and maintenance.
The docker exec --user www-data CONTAINER_ID php occ update:check
command is used to check for available updates. it checks if there is a new version or security update for NextCloud, notify you of any available updates.
In addition to system updates, the OCC
tool provides a wide range of functions such as user management, group management, file manipulation, database optimization, and checking security settings. For example, the following commands are available
- Display a list of users:
php occ user:list
- Create a new user:
php occ user:add [username]
- Scan files:
php occ files:scan --all
- Optimize database:
php occ db:add-missing-indices
These commands allow you to manage NextCloud without a GUI, which is very useful, especially when managing large instances or multiple instances. It is also possible to automate these commands using scripts.
When using the docker exec
command, it is important to run the command as the web server user (usually www-data
) by adding the --user www-data
option. This avoids file permission problems. Also, CONTAINER_ID
is the ID or name of the Docker container running NextCloud that you actually want to operate.
I checked for actual updates.
docker exec --user www-data nc php occ update:check
root@instance-20240128-2033:~# docker exec –user www-data nc php occ update:check
Nextcloud 28.0.2 is available. Get more information on how to update at https://docs.nextcloud.com/server/28/admin_manual/maintenance/upgrade. Get more information on how to update at . html.
Update for calendar to version 4.6.5 is available.
Update for contacts to version 5.5.2 is available.
Update for mail to version 3.5.6 is available.
Update for spreed to version 18.0.3 is available.
5 updates available
Then enter the upgrade command
docker exec --user www-data nc php occ upgrade
However, the following message is displayed, indicating that it is already the latest version.
Nextcloud is already latest version
I tried to update after putting it in maintenance mode, but it did not proceed as expected. The message “Nextcloud is in maintenance mode, no apps are loaded. message indicates that Nextcloud is in maintenance mode, no apps are loaded. Perhaps these errors related to the setup of Nextcloud may be the cause. The browser was displaying some problems.
There are several errors related to the setup.
- The reverse proxy header configuration is incorrect. this is a security issue and can allow an attacker to spoof their IP address as visible to the For more information, please refer to the documentation.
- You are accessing the instance over a secure connection, but the instance is generating an insecure URL. This may be behind a reverse proxy and the configuration setting variables may not have been properly overridden. Please read the documentation page for more information on this .
- 8 errors in the logs since February 17, 2024
- The “Strict-Transport-Security” HTTP header seconds is not set to at least “15552000”. To enhance security, it is recommended to enable HSTS as described in the security tip.
- The web server is not properly configured to resolve “/.well-known/caldav”. See documentation for more information.
- Your web server is not properly configured to resolve “/.well-known/carddav”. See documentation for details.
- The database is being used for transaction file locking. To improve performance, configure memory caching if possible. See documentation for details.
- This instance is missing some recommended PHP modules. It is highly recommended to install them to improve performance and compatibility: bz2. See the documentation for more information.
- Your system does not have a default phone region set. This is necessary to enable phone numbers without country code in your profile settings. To allow phone numbers without country code, add “default_phone_region” to your configuration file along with the ISO 3166-1 code for your region. See the documentation for more information.
- Mail server settings are not configured or unconfirmed. Please go to “Basic Settings” to configure the settings. Then confirm your settings with the “Send Mail” button at the bottom of the form. Refer to the documentation for more information.
You may need to resolve these issues before you experience update problems. Here is a summary of common solutions to each error message. You may need to fix these areas, especially since you are using a reverse proxy.
- Incorrect reverse proxy header settings: add
trusted_proxies
andforwarded_for_headers
settings toconfig.php
so that Nextcloud correctly recognizes connections from the reverse proxy. See the section on “Reverse Proxies” in the Nextcloud documentation for more information. - Secure connection and URL generation issues: set the
overwriteprotocol
option in theconfig.php
file so that Nextcloud always generates secure URLs. For example, if you are using HTTPS, add'overwriteprotocol' => 'https',
. - Strict-Transport-Security (HSTS) under-configuration: Add an HSTS header to your web server configuration (Apache, Nginx, etc.) to enhance security. HTTPS for all communication to the web site.
- Resolve .well-known/caldav and .well-known/carddav: Add a rule in the web server configuration to redirect these paths to the Nextcloud DAV endpoint. This will allow the calendar and contacts apps to function properly.
- Database performance issues: add a cache setting to the
config.php
file to improve database performance. For example, configure the system to use Redis or Memcached for caching. - Missing PHP modules: Install PHP modules (in this case bz2) that are not installed on your system. This will improve performance and compatibility.
- Default phone region not set: Add
default_phone_region
toconfig.php
to specify the country using the ISO 3166-1 code. This will improve handling of phone numbers without country codes. - Mail server settings: Configure the mail server settings from the Nextcloud administration page and verify that the settings are correct. This will ensure that sending mail from Nextcloud functions properly.
Note that it is also possible to enter the container and enter commands to update the settings. Here are the basic steps
- Back up the container Before updating, it is safe to make a backup of your NextCloud data and database for data safety.
- Enter the NextCloud container Enter the NextCloud container running on Docker. To do this, use the following command ( where
your_nextcloud_container
is the actual container name)docker exec -it your_nextcloud_container /bin/bash
- Use the command line update tool Within the container, use NextCloud’s command line update tool (
occ
command) to run the update process. Typically, the following command is usedsudo -u www-data php occ upgrade
wheresudo -u www-data
means to execute the command with the privileges of the web server user (e.g.www-data
).php occ upgrade
is the command to execute the NextCloud update. - Post-update processing Once the update is complete, restart the NextCloud container if necessary, or the associated service if using Docker compose.
- Confirmation of Operation Finally, access NextCloud through a web browser to verify that the update completed successfully and that everything is functioning properly.