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
209 stars 95 forks source link

How do I switch to `pokyuser` or set to correct user when running the container? #63

Closed HenrikBach1 closed 3 years ago

HenrikBach1 commented 3 years ago

Hi

I'm following your standard guide for setting up Yocto in the crops/yocto docker image. Instead of using workdir as a folder name I'm using yocto.

However, when I try to clone Poky into this folder, I get these error messages:

sh-4.4$ git clone git://git.yoctoproject.org/poky
fatal: could not create work tree dir 'poky': Permission denied
sh-4.4$ ls -halt
total 12K
drwxr-xr-x. 1 root     root     4.0K Jun 16 11:34 ..
drwxrwxr-x. 2 pokyuser pokyuser 4.0K Jun 16 11:19 .
sh-4.4$ pwd
/yocto
sh-4.4$ whoami
usersetup
sh-4.4$ sudo su pokyuser
[sudo] password for usersetup: 
Sorry, try again.
[sudo] password for usersetup: 
^C
sudo: 1 incorrect password attempt

How do I switch to pokyuser or set to correct user when running the container?

/Henrik

rewitt1 commented 3 years ago

Hi @HenrikBach1,

Could you post the full command you use to run the container?

HenrikBach1 commented 3 years ago
docker run -it -d --name yocto -v ~/projects/yocto:/yocto --workdir=/yocto crops/poky
rewitt1 commented 3 years ago
docker run -it -d --name yocto -v ~/projects/yocto:/yocto --workdir=/yocto crops/poky

Since this command is daemonizing the container, that most likely means you are using docker exec to issue the commands in the container. If this is the case, that means you'll have to explicitly specify the user as part of docker exec such as:

docker exec -it -u pokyuser yocto bash