ongardie / cubicle

Manage isolated development environments
MIT License
13 stars 3 forks source link

docker: Fix running as `root` #43

Closed ongardie closed 1 year ago

ongardie commented 1 year ago

I ran into some trouble trying to run Cubicle Docker environments as root:

11: Pulling from library/debian
10cff8997b4d: Already exists 
Digest: sha256:3e82b1af33607aebaeb3641b75d6e80fd28d36e17993ef13708e9493e30e8ff9
Status: Downloaded newer image for debian:11
 ---> 59ed139d178b
Step 2/8 : RUN echo Etc/UTC > /etc/timezone &&     ln -fs '/usr/share/zoneinfo/'Etc/UTC /etc/localtime
 ---> Running in b3346793084e
Removing intermediate container b3346793084e
 ---> e980d48c6ccd
Step 3/8 : RUN addgroup --gid 0 root || addgroup root &&     adduser --disabled-password --gecos '' --uid 0 --ingroup root root &&     adduser root sudo &&     mkdir /home/root/w &&    
 chown root:root /home/root/w
 ---> Running in 490bcc5504a4
addgroup: The group `root' already exists.
addgroup: The group `root' already exists.
The command '/bin/sh -c addgroup --gid 0 root || addgroup root &&     adduser --disabled-password --gecos '' --uid 0 --ingroup root root &&     adduser root sudo &&     mkdir /home/root
/w &&     chown root:root /home/root/w' returned a non-zero code: 1
Error: failed to update package: "configs-core"

Caused by:
    0: error building package "configs-core"
    1: failed to create environment "package-configs-core"
    2: failed to build "cub-cubicle-base" Docker image
    3: `docker build` exited with exit status: 1
root@debian:~/opt/cubicle# 

Seems like this should probably just pick another username, like "cubicle".

ongardie commented 1 year ago

(this was in a VM)