Closed mrtuborg closed 7 years ago
The poky container essentially does a similar thing as in the article linked.
A user is created dynamically to match the uid and gid of the workdir that was passed into the container. And so if you follow the instructions for creating a volume, the uid and gid would be 1000, because the instructions say to explicitly set that uid and gid on the volume. If you didn't run the step to set the uid and gid on the volume, then it defaults to 0.
However, there is also some additional protection used that won't let the uid or gid be less than 101, because those are typically reserved for users that have elevated privileges, including of course 0 or root.
So what looks like happened in your case, is that you were using a volume whose uid/gid are less than 101. And if you were using the instructions step by step most likely meant you perhaps missed the
docker run -it --rm -v myvolume:/workdir busybox chown -R 1000:1000 /workdir
thanks @rewitt1. This was helpful :)
Seems does not work in macOS Sierra:
This article has an universal approach, have to avoid using constants in gid and uid: https://denibertovic.com/posts/handling-permissions-with-docker-volumes/