Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Bind Volumes mess up with users and groups... #2971

Closed
bf8392 opened this issue Feb 1, 2020 · 8 comments
Closed

Bind Volumes mess up with users and groups... #2971

bf8392 opened this issue Feb 1, 2020 · 8 comments

Comments

@bf8392
Copy link

bf8392 commented Feb 1, 2020

When I mount a volume in docker-swarm as bind mounts, I get weired uid and gid diplayed on the data...on one container it is 999:root, on the other I bind-mounted a cifs share, which results into xfs:xfs.
I don't know how to resolve this, but it's a really severe problem, because I can't access the data inside a bind volume, without beeing root...so I cant't use nextcloud-docker etc....please help! I tried this many days now, and didn't find a solution or docs how to change this...

@thaJeztah
Copy link
Member

Ownership on Linux is based on the numeric uid/gid, and the names you'll see are taken from the /etc/passwd file. When using bind-mounts, there no "translation" of files created in the container (or, vice-versa, on the host); they're the same files, with the same permissions. If, for example, a file is created by the container with uid/gid 1000:1000, and the /etc/passwd file on your host has an entry for those ID's, it will show the user/group name matching tnt entry.

This answer on stackoverflow might provide some more details; https://stackoverflow.com/a/29251160/1811501

Please keep in mind that the GitHub issue tracker is not intended as a general support forum,
but for reporting bugs and feature requests. For other type of questions, consider using one of;

I'm closing this issue because this is not a bug, but feel free to continue the conversation

@bf8392
Copy link
Author

bf8392 commented Feb 2, 2020

Thanks but if I understand that right, that is exactly the bug I have...because on the docker-host the permissions are shown right...only inside the container the permissions are shown wrong...for example:

I mounted a smb-directory on the host with uid and gid 33. On the host it correctly shows www-data:www-data -> than I mounted this inside a nextcloud-container -> inside the nextcloud-container it shows xfs:xfs...but only in docker swarm! If I try the same with compose volume, everything is all right...

@thaJeztah
Copy link
Member

Are you running on Docker Desktop? (Docker for Mac / Windows)? When deploying on Swarm; do you have a single mode (local) or multiple nodes?

Docker Desktop strips ownership information when using bind-mounts; in that case, the owner inside the container will always appear to be "current user".

@bf8392
Copy link
Author

bf8392 commented Feb 2, 2020

ahhh okay I found it out! I use rancheros and it was an issue from there =) thank you =) [I had to switch to persistent console to make it working] thank you =)

@bf8392
Copy link
Author

bf8392 commented Feb 2, 2020

I still doing something wrong =(. I try to use nextcloud docker with bind-mounted volume for data...this is mounted samba-shara EXACTLY THE SAME WAY like on the old machine where it is working...but as soon as I try it with docker-swarm/rancheros, the datadir is not readable for the container user www-data....even the permissions (33:33 www-data:www-data 770) are displayed colpletely right, but the permission of www-data inside the container is denied...you have an Idea how to resolve this?

@bf8392
Copy link
Author

bf8392 commented Feb 2, 2020

outside the container everything works fine

@thaJeztah
Copy link
Member

no; no direct ideas; could be something in how rancher os is set up; not familiar enough with it to tell for sure

@bf8392
Copy link
Author

bf8392 commented Feb 3, 2020

Has anyone an Idea, what I could do wrong? Really geeting desperate about this XD. And I don't want to switch os, till I know why this happens....because possibly it's not a rancher-os problem, and then the problem occurs on the new server also...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants