# Nextcloud update / Upgrade to newest version

##### To update Nextcloud when automatic updating is disabled in the config.php file <span style="text-decoration: underline;">from a local machine</span>, you need to use the command line updater (occ upgrade). Here are the steps:

1. Open a terminal and navigate to the Nextcloud root directory.
2. Run the following command to start the command line updater:

```bash
sudo -u www-data php occ upgrade
```

---

##### To run the occ upgrade command from <span style="text-decoration: underline;">outside the Nextcloud Docker container</span> named "nextcloud", you can use the docker exec command like this:  


```bash
sudo docker exec --user www-data nextcloud php occ upgrade
```

##### Here's a breakdown of the command:

- `sudo docker exec` - This allows you to run a command inside a running Docker container.
- `--user www-data` - This specifies that the command should be run as the `www-data` user, which is the recommended user for running Nextcloud commands.
- `nextcloud` - This is the name of your Nextcloud container.
- `php occ upgrade` - This is the actual command to upgrade Nextcloud using the `occ` command-line tool.

So, the full command `sudo docker exec --user www-data nextcloud php occ upgrade` will execute the `php occ upgrade` command inside the "nextcloud" container as the `www-data` user, which is the recommended way to perform the Nextcloud upgrade.<button aria-describedby="radix-:r26:" data-state="delayed-open"></button>