Open TristanPouliquen opened 2 years ago
I'm experiencing the exact same issue (docker desktop for linux on Ubuntu). Attempting chown -R dev:dev .
in the working directory in the container gives them the correct ownership in the container, but assigns them to non-existent uid/gid on the host. On the host executing chown -R alec:alec .
reverts them to the correct ownership on the host but back to root:root in the container.
Are there any workarounds known for this yet?
@alec-w So, as far as I understand it, the fact that the files in bind mounts are being mounted as root:root
is a bug in docker desktop for linux. You can also see this related in https://github.com/docker/desktop-linux/issues/81 and various other bugs in the docker-compose repo as well.
The fact that chown
ed files get a high numbered UID:GID is actually, unfortunately, by design as far as I can tell. Its because of the use of VirtioFS running under a non-root user so it's using user namespaces to map the host user to uid 0 inside the container, and all other userids to whatever mapping is defined in /etc/subuid.
The upshot of this is that if you try to use mounted volumes in Docker Desktop with the containers that you lovingly crafted to avoid running as root by default with, you end up in kind of a mess. I haven't had a chance to test the scenario with Docker Desktop on mac using VirtioFS yet, but I am hoping not, otherwise it's going to be a bit of a mess if they make VirtioFS the only storage driver.
You can find some more info about this behavior at https://docs.docker.com/desktop/faqs/linuxfaqs/#how-do-i-enable-file-sharing
Having the exact same problem detailed above. Is there any known fix or workaround for this?
The best plan I have is to make a container with a root user, and do docker-in-docker inside THAT container to run the actual service containers with the expected user/file permissions
On Fri, Feb 17, 2023 at 7:15 AM Ángel Blanco @.***> wrote:
Having the exact same problem detailed above. Is there any known fix or workaround for this?
— Reply to this email directly, view it on GitHub https://github.com/docker/desktop-linux/issues/149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB45OVBSWMDOQTQ4AGQJZ3WX5TVJANCNFSM53VZ377A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Same issue here. I have to manually switch my docker context to use the "default one"
docker context use default
But I have to do that on each reboot, and can't use the "beautiful" docker desktop interface
I am also running into the same issue. Using VirtioFS leads to better performance but diverges the functionality of Docker desktop in Linux from Windows or Mac. That is not ideal.
While using the docker desktop we get a different way in how the volumes are mounted, in that the host user files are mounted as root (0)user inside the container. But when we use default docker, we do not run into such issues, the host uid is the same as the container user uid when we mount the volume.
Is there any plan to fix this inconsistency?
Let me transfer this ticket to the docker desktop for linux issue tracker
@thaJeztah where was this issue moved to? I cannot see were it was moved to. I am running into the same issue.
I can confirm that this issue is still present in Docker Desktop for Linux. After spending a lot of time to find the cause and potential work-arounds for the issue, I was very happy to finally find this issue filed by @TristanPouliquen The paradox is that the reason to choose Docker Desktop in the first place was to get a user-friendly way of dealing with root-less Docker.... I am really surprised that this issue has not attracted more attention as it makes Docker Desktop on Linux useless. I guess people are just reverting to the Docker Engine. @thaJeztah Have there been any efforts or plans to solve the issue??
Expected behavior
Hello, we have a set of containers built with Docker Compose for our code. In our Dockerfile, we create a custom user, assigning it to the 1000 UID.
When running
docker compose up
in thedefault
context (with the socket in/var/run/docker.sock
), our codebase is correctly mounted to the containers using our custom user.We want to use Docker Desktop for Linux to unify our Docker management through Windows & Linux.
We expected to be able to install Docker Desktop, build our containers, launch them, see them in the interface & be able to continue coding normally.
Actual behavior
When switching to the newly generated
desktop-linux
context, we correctly see our containers in the application interface.BUT
When we build & launch our containers with
docker compose up
, the files from our codebase are mounted under theroot:root
ownership.We are then unable to correctly install dependencies through Composer, Yarn, or to navigate in our app as we get permission errors every time we try to acces/write to a file.
Steps to reproduce the behavior
I will try to generate a minimum reproduction example
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.)