gmacario / easy-build

Collection of Dockerfiles for building embedded software distributions
Mozilla Public License 2.0
154 stars 83 forks source link

Dockerfile: Create a non-root user "build" #213

Closed gmacario closed 8 years ago

gmacario commented 8 years ago

Fix issue https://github.com/gmacario/easy-build/issues/211

Signed-off-by: Gianpaolo Macario gianpaolo_macario@mentor.com

gmacario commented 8 years ago

Testing on a local build

$ git clone -b fix-issue-211 https://github.com/gmacario/easy-build
$ cd easy-build
$ docker build -t gmacario/build-yocto-new experimental/build-yocto-new/
$ docker run -ti gmacario/build-yocto-new

Result:

root@23165c7ab151:~/tmp/easy-build# docker run -ti gmacario/build-yocto-new
build@d73715372f73:~$ pwd
/home/build
build@d73715372f73:~$ whoami
build
build@d73715372f73:~$ id
uid=30000(build) gid=30000(build) groups=30000(build)
build@d73715372f73:~$ sudo -i
root@d73715372f73:~# pwd
/root
root@d73715372f73:~# whoami
root
root@d73715372f73:~# id
uid=0(root) gid=0(root) groups=0(root)
root@d73715372f73:~# exit
logout
build@d73715372f73:~$ exit
exit
root@23165c7ab151:~/tmp/easy-build#
gmacario commented 8 years ago

LGTM, merged