docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.75k stars 1.08k forks source link

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

Closed bf8392 closed 4 years ago

bf8392 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

outside the container everything works fine

thaJeztah commented 4 years ago

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

bf8392 commented 4 years ago

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