Is there any way to mount a named volume as a non-root user? I am trying to avoid having to run a chown
in each Dockerfile but I need the mount to be writable by a non-root user to be able to write the artifacts created by a build in the image
This is what I'm trying
docker run --rm -it -v /home/bob/dev/:/src/dev -v builds:/mnt/build --name build hilikus/build /bin/bash
but for the second mount I get
[user@42f237282128 ~]$ ll /mnt
total 4
drwxr-xr-x 2 root root 4096 Sep 18 19:29 build
My other mount (/src/dev/
) is owned by user, not by root so it gives what I need; however, I haven't been able to do the same with the named volume.
VOLUME /data
, when I do thedocker run
as you show, everything is back toroot
ownership (note that another difference is that my volume is empty at start, so I only change the volume folder ownership. – Corabelle