Need help updating NextCloud using docker

I’m trying to update NextCloud that is in a Docker container and I’ve had no luck anywhere.

Next cloud is wanting me to update via command line.
image

When I attempt to use command line to update the OCC (path: /var/lib/docker/volumes/Nextcloud_Application/occ)
It is unable to open the OCC file from outside of the container.
So when I go into the container and attempt to update it that way, I will get:

root@802d9c7ef14f:/var/www/html# ./occ upgrade
Console has to be executed with the user that owns the file config/config.php
Current user id: 0
Owner id of config.php: 33
Try adding 'sudo -u #33' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 33' to the docker command (without the single quotes)

I have tried ./occ upgrade -u 33 and I get the same message.

I’m at a loss.

Please review the right upgrade procedure GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud

1 Like

Indeed. What @wwe said:

docker compose pull
docker compose up -d

The language re: command line updater is also a bit clearer in >=v29 for those using Docker/etc.

P.S. This part:

If running with 'docker exec' try adding the option '-u 33' to the docker command (without the single quotes)

…means use a command like the following to open a shell in the container as the appropriate user ID:

docker compose exec -u33 app bash

Beware that you have to run the same command with the options that you used to initially start your Nextcloud. That includes volumes, port mapping.

Oh, welp. Hopefully, I can recover the container, I have no clue what volumes I’ve used if any, only port configs.

That is why most people using Docker use Compose files.

Otherwise you’re basically responsible for scripting / tracking your run commands.

Oh, welp. Hopefully, I can recover the container, I have no clue what volumes I’ve used if any, only port configs.

Did you originally use a run command like these maybe?

Anyhow, you can check the Docker docs for things like listing your current volumes, etc.. That’s kind of outside the scope of Nextcloud itself.

Honestly not sure, Its been a long time since I’ve set it up.

I at least know where the occ is located /var/lib/docker/volumes/Nextcloud_Application/occ , so if that’s the default location for a Nextcloud docker install, I likely just followed that, which hopefully was the how nextcloud wanted me to install it and not someone’s guide.

EDIT:

[
    {
        "CreatedAt": "2024-04-06T21:36:32Z",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/Nextcloud_Application/_data",
        "Name": "Nextcloud_Application",
        "Options": null,
        "Scope": "local"
    }
]

Looks like it completely reset itself… Oh well, I’ll learn to use snapshots next time.

It really isn’t.

/var/lib/docker/volumes is the a fairly common location for Docker’s own managed volumes within most UNIX-like environments. But the containers/apps (Nextcloud included) have zero awareness of it. It’s purely a construct on your underlying host.

If you brought up the instance using Docker manged volumes, the volumes are either named what you specified on the command-line (using run) or self-documented in your Compose file (in the latter with your stack folder name prepended by default).

Definitely do not run occ from the /var/lib/docker/volumes path. That path is outside the container. The entire point of containers is to isolate things from your host environment. occ must be run within the container not on the underlying host. At best it will simply fail from there.

Looks like it completely reset itself… Oh well, I’ll learn to use snapshots next time.

So the contents of /var/lib/docker/volumes/Nextcloud_Application/_data on your host is empty? I thought you said it contained occ? If so, it should have subfolders in it as well, containing your actual data files (data/), config files (config/), apps (custom_apps), etc.

There are some other ways of bringing up Docker instances, that would result in some of those things (your data, config, apps, etc.) being located in separate volumes, but they’d be located elsewhere in /var/lib/docker/volumes.

It really sounds like you’re not very familiar with Docker (which is completely fine!), but it would behoove you to get a bit familiar with it if you’re going to use a Docker-based deployment. If you don’t want to go down that direction, there are numerous other ways of installing Nextcloud that don’t involve Docker at all. Many of which are highlighted here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.