Open dwt opened 2 years ago
I like this write-up that goes over more details of some of the available workarounds. It doesn't exactly mention their weaknesses, but AFAIK none of them are achievable with just plain docker-compose usage.
https://techflare.blog/permission-problems-in-bind-mount-in-docker-volume/
Are there any plans to develop this feature?
I'm interested too, is there any update on this?
I arrived here because I'm having a problem where when my containers are active, I cannot edit the files that are part of my bind mount without using sudo, which is a big problem for working in VSCode that doesn't have sudo permissions. I'm using an rshared
bind mount so that a webpack development script in my node container can watch for changes in files and compile a new script based on changes.
Tell us about your request I want to be able to mount volumes, especially bind mounts with custom permissions in the container.
Which service(s) is this request for?
docker
anddocker compose
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? This should allow me to share files (
~/.ssh
, but also source code of apps I am working on) with a custom user in the container without having to ensure that it'sid
's match what is used outside the container. (As matching id's can be really hard for dev containers hat are used across a range of systems.)Are you currently working around the issue? I am aware of several workarounds which all not quite suit my needs.
ENTRYPOINT
script to copy the data to the final place andchown
andchmod
id there. This works to some degree, but is unsuitable, if the data in the bind mount changes, or a custom user is wanted in the container.uid
andgid
of the user outside the container. That way the bind mounts present their permissions correctly in the container. This however is hard if the container is used on a large variety of machines, as is customary for development containers. As there is (to my knowledge) no custom tooling in place indocker compose
ordocker
to make this easy, it requires custom tooling around those tools to ensure that UID mapping works, which makes it a clunky workaround.