I use the official golang docker image to compile my go program and put the resulting executable on a volume mapped to my host directory.
The problem is that file generated by docker belongs to root:root, which is very annoying because I do not want to run my script via sudo.
I searched for solutions to make docker container run as non-root, but the method I found need to change Dockerfile and add user to the image, e.g.
http://gbraad.nl/blog/non-root-user-inside-a-docker-container.html
Is there a way to make docker container run as the CURRENT user on host machine, i.e., user A runs this image will generate file belongs to A:A, and user B generate file belongs to B:B, while A and B are both users defined on host machine (i.e. where the volume resides), without the need to add A and B into the image via Dockerfile?