crops / poky-container

A container image that is able to run bitbake/poky. It has helpers to create users and groups within the container. This is so that the output generated in the container will be readable by the user on the host.
GNU General Public License v2.0
206 stars 94 forks source link

Dockerfile, lines 31 & 32 #14

Closed mrtuborg closed 7 years ago

mrtuborg commented 7 years ago

Seems does not work in macOS Sierra:

Status: Downloaded newer image for crops/poky:latest
Refusing to use a uid less than 101
Traceback (most recent call last):
  File "/usr/bin/usersetup.py", line 66, in <module>
    subprocess.check_call(cmd.split(), stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', 'restrict_useradd.sh', '70', '70', 'pokyuser']' returned non-zero exit status 1

This article has an universal approach, have to avoid using constants in gid and uid: https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

rewitt1 commented 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
mrtuborg commented 7 years ago

thanks @rewitt1. This was helpful :)