Score:1

What's an easy way to access a directory of a docker volume with Nextcloud which is running in another docker container?

mm flag

I hope this is the right place to ask this question.

My problems is as follows: I have a Ubuntu Server 22.04.2 with docker running on my home server. On one docker container I'm running Nextcloud and on another container I'm running paperless-ngx. Now I would like to access my scanned files from paperless via nextcloud.

  • So far I tried using Proftpd to add my Paperless-ngx archive directory via FTP as external storage to nextcloud. I think that this didn't work, because the docker volume isn't saved on my profile but instead in the system(?) files. So I couldn't access the directory with my profile login and also trying to login in as a root user didn't work either.

  • Next, I tried to create a soft/symbolic link with ln -s /<path to directory> /<path to directory>. The link was working but I also couldnt create the external storage on nextcloud with Proftpd. I'm not entirely sure why it didn't work, but I think it's because the linked directory has the same root settings (which I was not able to change) as the original directory thus using FTP was not possible.

  • Lastly, I tried using a soft link from my paperless directory directly to my nextcloud directory. I could see the directory in the terminal but it didn't show up, when I tried to access it in nextcloud.

I'm pretty new to using Ubuntu Servers and Docker containers so I probably made some silly decisions along the way. Could I have done something different to get it to work? Or are my "workarounds" not feasible at all? If so: Is there an easy solution to get this to work?

Artur Meinild avatar
vn flag
Many containers include instructions for using bind mount volumes, such as [this Nextcloud container](https://hub.docker.com/r/linuxserver/nextcloud) by Linuxserver.io (notice the `volumes` section).
ubuntunovice avatar
mm flag
That sound very interesting, I'll take a look into that. Thanks for the suggestion
Score:0
vn flag

The easiest way to do this (for homelab use) is by using Docker bind mounts for persistent storage.

The official Nextcloud image even has a section describing this (under Persistent Data).

An example of the command needed to run with persistent volumes for the config and data would be:

$ docker run -d \
    -p 8080:80 \
    -v /path/to/appdata:/var/www/html/config \
    -v /path/to/data:/var/www/html/data \
    nextcloud

Here, /path/to/appdata and /path/to/data need to be replaced with the actual full path of the folder where you want this persistent storage to be.

You could then map the folder /path/to/data into another container using the same method, allowing this folder to be directly shared between multiple containers and the host filesystem itself.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.