In docker, writing file to mounted file-system as non-root?
docker
Solution
EDIT: this has changed since my original answer which said it couldn't be done. As per answer of Mandark:
This can be done by using the -u switch for the docker run command.
For example:
docker run -v /home/dan:/home/dan -u `id -u $USER` IMAGE
Problem
I have a docker container with a `-v /home/dan:/home/dan:rw`. When the container writes files to `/home/dan`, the files are owned by root in the host filesystem. Is there a way to make it so that files written from the container to the mounted volume are owned by some arbitrary user on the host filesystem?