azukaar / Cosmos-Server

☁️ The Most Secure and Easy Selfhosted Home Server. Take control of your data and privacy without sacrificing security and stability (Authentication, anti-DDOS, anti-bot)
https://cosmos-cloud.io
Other
2.99k stars 108 forks source link

[BUG]: #143

Closed spinningjenny69 closed 8 months ago

spinningjenny69 commented 8 months ago

What happened?

When i try to bind to a folder like /mnt/NAS that is mounted in the host system to a smb share it can't mount it in cosmos as a container. It spits out an error that it cant find the folder under /mnt/host/mnt/NAS.

What should have happened?

I get that it binds the cosmos server from /:/mnt/host but i should be able to bind normally to the host system without the /mnt/host

How to reproduce the bug?

  1. Go to any container
  2. bind to a folder like /mnt/nas or create a new folder like /nas
  3. it creates a new folder and doesnt use the host system

Relevant log output

No response

Other details

No response

System details

azukaar commented 8 months ago

Cosmos shows you /mnt/host/mnt/NAS because as you mentionned it uses /mnt/host/ as a redirection to access the host's own root folder (/)

When you create a container with /folder/path in Cosmos, it will create the folder in /mnt/host/folder/path (which matches /folder/path on the host) and will bind /folder/path to the container, so the container never knows about the /mnt/host redirection.

Make sure the folder you use does not have /mnt/host in it, Cosmos does this under the hood for you Also make sure your container has permission on your target folder

For example this works fine:

image

spinningjenny69 commented 8 months ago

I get everything you described. For example i installed filebrowser using cosmos and i can see every folder on the host system. This is fine. But if i mount a folder from my nas using smb in a folder on the host system (/mnt/Media/), that doesnt show up in filebrowser and conequently not in cosmos either. The redirect doesn't work in this case.

Lastly a container that i try to bind to /mnt/Media is automatically redirected to /mnt/host/mnt/Media so it can't find the original smb mounted folder.

Is there a way to go around this problem or how can i fix it? Is it a problem because it is an externally mounted folder (smb or ftp)?

azukaar commented 7 months ago

My gut feeling is that it will be better solved once Cosmos is out of Docker. I would assume it is possible to get it to work, otherwise many people would have flagged it before. What do you use to create your mount? is it a symlink to somewhere else?