+1
Answered

Cannot follow symlink inside "user-files" in docker image: "The item is no longer available!"

wonx 1 year ago updated by Vlad R 4 months ago 2

I migrated my server and installed the docker image of FileRun instead of doing it the old way. However I can't seem to make it follow symlinks as it used to.

For instance, inside ~/filerun/user-files I create a symlink pointing to /mnt/sda1 (a path that I also added to the docker-compose.yml file). I start the docker image (and I enter its console, to verify that the symlink indeed works). I enter the FileRun in my browser, and it lists a folder with the name of the symlink, but as soon as I click on it, a message saying "The item is no longer available!"

However, if the symlink points to /var/www/html (a folder that is already owned by the www-data user), FileRun is able to list all its contents.

Also, replacing the user-files folder by a symlink with the same name pointing to its destination (/mnt/sda1), also works and FileRun can see all the files without problems.

I basically want to have three symlinks at the root of the user-files folder, to point at three different directories where some files are stored, which are in separate paths of my server. It used to work in the classical install of FileRun (making sure the user www-data could read those folders), but I can't figure out how to make it work in docker.

Thanks in advance!

EDIT: I think I figured it out. I'll answer myself:

Apparently there are some complications when using symlinks inside a docker container. What I did is create a folder for each symlink I wanted, and create volumes in the docker-compose.yml directly pointing to the destination path.

For instance, I want to access /mnt/sda1/Pictures/John, /mnt/sda2/Documents, and /mnt/sda2/Pictures, and all of that under the root at /user-files:

- /user1/filerun/user-files:/user-files

- /mnt/sda1/Pictures/John:/user-files/Pictures/John

- /mnt/sda2/Documents/John:/user-files/Documents

- /mnt/sda2/Pictures:/user-files/Pictures/MorePictures

This way, it works, assuming you have the correct permissions.

Is this still the recommended method to allow Dockerised FileRun access to your existing files?
I believe the above is not practical as it will do more I/O on your harddrive because Docker sees each of his 4 mounts as seperate filesystems.

Perhaps another method would be to mount a single path:

/$USERDIR/docker/filerun/user-files:/user-files

and create actual symlinks in /$USERDIR/docker/filerun/user-files to the actual folders you want access to.

So you will get

/$USERDIR/docker/filerun/user-files/Documents (which could be a symlink to /mnt/drive1/documents)

/$USERDIR/docker/filerun/user-files/Pictures ((which could be a symlink to /mnt/drive1/pictures)

etc

Would that be the best method? Or should it be hardlinks instead? In order to maintain access to your files via other ways than FileRun?

+1
Answered

The only method that works is the one described in the above post's edit. You cannot symlink folders into a Docker volume otherwise Docker would just have access to the whole filesystem and the volume system would be pointless.