Nextcloud docker does not ask where to put the data directory

Hi,
I would like to reinstall my nextcloud instance in order to move the data directory to somewhere else (there is not much stored in nextcloud at this point anyway and I don’t want to mess with the db).
But nextcloud does not ask me anymore where to store the data.
At what point during the installation should this happen? Can I force it? Or could I provide the info via the .env file (just this one piece of info)?
Thanks

1 Like

If you’re using docker, you should probably specify the data directory in docker-compose.yml. For example, I have this line in my docker-compose under nextcloud:
- /home/user/docker/data/nextcloud-data/:/data
This tells the container to store its /data folder in the directory /home/user/docker/data/nextcloud-data on the host machine.

Not sure what docker image you are using, so maybe check its documentation?

Thanks but this does not work for me.

I am using the stock image from nextcloud.

I edited my docker-compose.yml file according to your suggestion but nextcloud set up its /data folder within /var/www/html instead, ignoring my instructions.

To be sure, I kept the original line

- nextcloud:/var/www/html

and added your line (with a different path on my system)

- /home/user/docker/data/nextcloud-data/:/data

Or should I have replaced the original line? But in that case, where would all the other folders go (like config, etc.)?

Thanks!

I checked the documentation for the official image, and there is a working docker-compose example. The line

nextcloud:/var/www/html

is what specifies what goes where. The first part before the colon is your host folder (here just nextcloud) and the second part is the image path. So in this case, the image’s path /var/www/html is mounted to your Nextcloud.

Try this:

  • /path/:/var/www/html
  • /datapath/:/var/www/html/data

This is assuming that there is a /var/www/html/data inside the image, of course.

1 Like

Thank you for following up!

I had experimented a bit further after my post and had success with

/path/outside/container/:/var/www/html

This now encompasses not only the /data directory but everything in the container - which is fine for me as I wanted to have the config and other important files as well anyway.

Tanks again!

1 Like