January 27, 20215 yr Hi Everybody! Is there a good way in unraid to converst absolute path symlinks to relative path? Some more context: I would like to use folders/files with symlinks in a docker. However, the symlinks have absolute path, which won't work within docker, unless I give more broad permissions. Thus I would like to convert the existing symlings to relative path. I can give the docker access to the actual (non symlink) files, but their folder structure is not useful in that docker context. This tool seems to be perfect for the job, but not sure if it's even installable in unraid: https://github.com/brandt/symlinks Any thoughts on how to make this symlink tool work in unraid? Any other ideas on how to convert the symlinks to relative path? Thank you! Edited January 28, 20215 yr by froland80 marking as solved
January 28, 20215 yr This is not possible. Docker containers aren't allowed to access paths which aren't mapped. So if you map /container/data to /host/data, the container is not able to reach /host/documents. No matter if absolute or relative path. If this would be possible, this would be a security hole.
January 28, 20215 yr Author Thanks, @mgutt. The docker can access the original files, but they are in an inconvenient file/folder structure. Thus, I created a version with symlinks in a better structure. The problem is that the symlinks are absolute path and the docker does not have access to all the parts of the absolute path. So, the docker can't resolve the links, even if it would have access to the files. ...at least that's what I understood from here. So, relative links should make it work or did I miss anything? This tool should do it, but unraid doesn't seem to have the "make" command to install/compile the tool. Can I just compile that on a mac and then transfer it over?
January 28, 20215 yr 7 hours ago, froland80 said: So, relative links should make it work or did I miss anything? Yes, but only if the target path is inside of the mapped path. Example: /container/data maps to /host/data Relative link: image.jpg Would target: /container/data/image.jpg which maps to: /host/data/image.jpg Would not work: ../images/image.jpg Would target: /container/images/image.jpg which maps to nothing (it stays inside the docker itself). This would only work if you map /container/images to /host/images as well or if you would map /container to /host for much broader access to the host (which was done in the "Plex example"). Depending to your target it's maybe better to create hardlinks to all the files that should be accessible through the container. But note: hardlinks work only for files. But they allow the following: /host/some_files/image.jpg links to /host/images/image.jpg /host/some_files/texts/text.txt links to /host/texts/2021/01/28/text.txt Now you map /host/some_files to the container and it can only access those files.
January 28, 20215 yr Author 2 hours ago, mgutt said: 10 hours ago, froland80 said: So, relative links should make it work or did I miss anything? Yes, but only if the target path is inside of the mapped path. Agree. Think for my case that would have actually worked. 2 hours ago, mgutt said: Depending to your target it's maybe better to create hardlinks to all the files that should be accessible through the container. Great idea! Used this command to convert my symlinks into hard links and now it works perfectly! Thank you! Marking this as solved.
Archived
This topic is now archived and is closed to further replies.