Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Convert symlinks absolute to relative paths (SOLVED)

Featured Replies

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 by froland80
marking as solved

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.

  • 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?

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.

 

 

  • 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.

  • froland80 changed the title to Convert symlinks absolute to relative paths (SOLVED)

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.