Data location missing and need to move

Hi,

Hopefully correct location this time.

Hoping to get some help on slightly confusing issue but I might be missing something stupid.

Following video for install and all appears to be working.

But…

I want to move the data directory.

In config.php it says : ‘datadirectory’ => ‘/var/www/html/data’

which I believe is standard.

But “www” doesn’t exist in that folder even as a hidden file.

If I do a find on the linux OS I see that files are :

/var/lib/docker/volumes/nextcloud_nextcloud_data/_data/data/

But I can’t see that in config.php.

What am I missing to change the location of the data?

Thanks for any assistance.

Additional info below:

Nextcloud Server version (e.g., 29.x.x): 31.0.0
Operating system and version (e.g., Ubuntu 24.04): Raspbian Debian Lunix 12
Web server and version (e.g, Apache 2.4.25):
Reverse proxy and version _(e.g. nginx 1.27.2):
PHP version (e.g, 8.3):
Is this the first time you’ve seen this error? (Yes / No): Yes
When did this problem seem to first start? : from install
Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.) : docker-compose yaml file
Are you using Cloudflare, mod_security, or similar? (Yes / No) : No

Hello @tappers, welcome to the Nextcloud community :handshake:

In Docker persistent data is stored using volume mounts or bind mounts - Storage | Docker Docs - which you define either in your compose file or in the command line - review persistent data

Thanks for the reply.

That makes sense.

I don’t intend to run anything else on this Pi as I have a Virtual Server for other stuff so wondering, would I benefit from doing a native install of Nextcloud on a Ubuntu base OS?

Hi,

Due to a variety of reasons I have wiped the Pi SD card and started again, with the docker install of nextcloud.

I am trying to correct (for my install) or change the data directory but the install fails so I am not sure what I am missing the in the documentation.

My docker-compose.yml file is as follows:

version: '3'
services:
    db:
        image: mariadb
        restart: always
        volumes:
            - db_data:/var/lib/msql
        environment:
            MYSQL_ROOT_PASSWORD: xxxxxxxxxxxxx
            MYSQL_PASSWORD: xxxxxxxxxxxxxxxxxxx
            MYSQL_DATABASE: nextcloud_db
            MYSQL_USER: nextcloud_usr
    app:
        image: nextcloud
        ports:
            - 8080:80
        links:
            - db
        volumes:
            - nextcloud_data:/var/www/html
        restart: always
volumes:
    db_data:
    nextcloud_data:

I have tried the following -

    volumes:
        - nextcloud_data:/var/www/html

Replaced with -
volumes:
- nextcloud_data:/mnt/nvme
And -
volumes:
db_data:
nextcloud_data:/mnt/nvme

But then can’t run - docker-compose up -d

Which just generates different errors.

How do I add it to the docker-compose and complete the install, any assistance to resolve is welcome ?

Many thanks

Hello @tappers!

It would be very helpful to know what errors you are seeing - the errors often say what is wrong, and is a super important context in order to assist you.

Could you share those? :slight_smile:

Also it makes it much easier to read your config files if you can paste the configuration in triple ticks;

``` code here ```

1 Like

Hi denNorske,

Thanks for the reply and you are 110% correct and I should have known better, apologies for not including them.

Noted on the config files sharing, will do in future.

So I turned the Pi off to do something else but turned back on when I saw your message and re ran : docker-compse up -d

and this time it worked, although I entered my password in the gui and the screen flickered and it went to the login even though I hadn’t entered other details so not sure what happened there.
But either way still the same issue I can’t get it to relocate the data directory.

docker-compose.yml:

version: '3'
services:
    db:
        image: mariadb
        restart: always
        volumes:
            - db_data:/var/lib/msql
        environment:
            MYSQL_ROOT_PASSWORD: xxxxxxxx
            MYSQL_PASSWORD: xxxxxxxxx
            MYSQL_DATABASE: nextcloud
            MYSQL_USER: nextcloud
    app:
        image: nextcloud
        ports:
            - 8080:80
        links:
            - db
        volumes:
            - nextcloud_data:/mnt/nvme_drive/nextcloud_data
        restart: always
volumes:
    db_data:
    nextcloud_data:

Where do I change the data location if the above is incorrect?

Thanks again.

did you read the volumes info I shared?

The data, config files are stored in respective subfolders inside /var/www/html/

you mount the nextcloud_data volume into /mnt/nvmes_drive.. inside the container which obviously doesn’t exist.

Please familiarize yourself with Docker volumes

BTW: code tags are backticks=`` and not single quotes=’ … there is a button </> as well to add correct markup

Thanks, I perhaps didn’t read it line for line but I think the issue might have also been that I kind of skipped by the stuff that mentioned: /var/www/html since that doesn’t exist so I couldn’t change anything related to that.

You mention of " you mount the nextcloud_data volume into /mnt/nvmes_drive.."
I had see reference to this but in my head I couldn’t understand mounting a folder into the /mnt/nvmes_drive but wondering if that is a Docker related thing as I was thinking of volume in a different way.

Apologies didn’t add to first post, I use Linux but no way an expert and have never really used docker so might be mixing terms etc.

I will have a proper read through the links

So you are currently mounting the path /mnt/nvme_drive/nextcloud_data in context of the container file system, inside a volume called nextcloud_data. A volume in this context, is a way of telling docker to store changes to the file sytem on that path, in a volume, so that the changes persist across container restarts and re-creation.

What you most likely wanted to do, is to mount the path on your host system /mnt/nvme_drive/nextcloud_data into a folder inside the container, so that nextcloud can read that data, right?

I am not entirely sure what the nextcloud data folder you have contains everyting like data and config files, but you need to adjust that according to what you have.

So instead, if you want to mount a host path to a container path, you need to do something like this:

volumes:
  - /mnt/nvme_drive/nextcloud_data:/var/www/html  # paths are host:container

if it is the actual data, then use the container path /var/www/html/data instead. This makes the host folder, available at the defined path inside the container.