I'm using Docker (1.3.1) to build RPMs inside a container:
docker run -v /home/matt/build:/build build-rpm /build/build-pkg.sh
This works fine (my user is in the docker
group, so I don't need to sudo) and drops a completed .rpm
file in the current directory. The problem is that the file is created as owned by root.
How can I arrange it so that the file is created owned by the same user as I run docker with?
Docker runs as root and has no idea what your user is inside its virtual environment (even if you're in the sudoers group). But you can create a non-root user while building your docker image that can be called whatever you like.
You could try to create (in the Dockerfile of a custom image) a user and set it as the one used by the container
Then check if a
docker run -v /home/matt/build:/build build-rpm
mounts the shared folder in /build asauser
.Another option mentioned in issue 2259: