Share access to a directory in and out of docker

You either have rootless Docker or Docker DEsktop that works similarly regarding file permissions. The reason is exactly security. So your own user’s file could be read by root in the container and you don’t actually need to mount anything from the root user.

We discussed it a couple of times, but I didn’t have time to make it a blogpost yet. Some I found on the forum

It is about permissions on Linux. With or without containers, it doesn’t matter. If the files have the right ownerships and permissions, and users have the right groups, multiple users can access the same files. In rootless Docker you need to know about the UID mapping which is the same as when using user namespaces as that is what the rootless Docker is based on.

.

1 Like