<div dir="ltr"><div dir="ltr">On Sun, Mar 6, 2022 at 8:01 AM Alexander Neundorf <<a href="mailto:neundorf@kde.org">neundorf@kde.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Samstag, 5. März 2022 19:11:53 CET Ben Cooksley wrote:<br>
> On Sun, Mar 6, 2022 at 6:17 AM Alexander Neundorf <<a href="mailto:neundorf@kde.org" target="_blank">neundorf@kde.org</a>> wrote:<br>
> > On Sonntag, 21. November 2021 21:38:14 CET Albert Astals Cid wrote:<br>
> > > El diumenge, 21 de novembre de 2021, a les 18:20:08 (CET), Alexander<br>
> > <br>
> > Neundorf va escriure:<br>
> > ...<br>
> > <br>
> > > > Is there a reason why less, vi and mc are not part of the image ?<br>
> > > > They make working in the container much nicer :-)<br>
> > > <br>
> > > You can always<br>
> > > <br>
> > >   sudo apt install vim<br>
> > > <br>
> > > no?<br>
> > <br>
> > I get errors:<br>
> > I have no name!@8fdf0c048ce2:~$ sudo apt-get install vim<br>
> > sudo: you do not exist in the passwd database<br>
> > I have no name!@8fdf0c048ce2:~$<br>
> <br>
> If you'd like to be root then something like this should work:<br>
> <br>
> docker exec -u root $containerId /bin/bash<br>
> <br>
> Bit unusual that you have managed to get a shell as a user account that<br>
> does not exist, by default both our SUSE CI images and the Android CI image<br>
> should run shells as root.<br>
> The Android SDK image should spawn a shell as 'user' (UID 1000)<br>
<br>
I mounted my host users src-directory into the container, so I need to have <br>
the same user- and group-ids in the container as on the host.<br>
If I run as root in the container, I am also root on the directory which I <br>
mounted into the container, so if I touch something in the container, it's <br>
owned by root, also on the host.<br>
Using the same user ID in the container as on the host makes that work <br>
smoothly (but then I'm not root and cannot install anything).<br>
Then I can simply edit on the host using kate or whatever, and build in the <br>
container, and nothing is lost, neither sources nor build results.<br></blockquote><div><br></div><div>I see. In this case I would suggest creating (via a root terminal) a matching user account/group in the container before beginning usage of it.</div><div><br></div><div>The normal 'user' account in the container is created with UID 1000 I believe which for the vast majority of people should match their host system.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Maybe during container startup the /etc/sudoers could be patched so that it <br>
allows the user who is running it can do sudo...<br></blockquote><div><br></div><div>We don't allow sudo because permitting that would allow attacks against the CI system physical hosts.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> > When mounting /etc/passwd into the container I get the following:<br>
> > <br>
> > alex@792716dfb133:~$ sudo apt-get install vim<br>
> > [sudo] password for alex:<br>
> > Sorry, try again.<br>
> > [sudo] password for alex:<br>
> > Sorry, try again.<br>
> > [sudo] password for alex:<br>
> > sudo: 3 incorrect password attempts<br>
> <br>
> You will need to mount /etc/shadow in as well for your password to come<br>
> through.<br>
> I wouldn't recommend mounting either file into the container though.<br>
<br>
They are mounted read-only, I'm using that since years for other purposes <br>
without problems. What issues do you see ?<br></blockquote><div><br></div><div>If your distribution and the container distribution are different, then certain files within the container will no longer be owned by the appropriate system accounts.</div><div>It sounds like you are mixing Ubuntu and SUSE which will definitely trigger this.</div><div><br></div><div>This may lead to setuid binaries (not owned by root) not behaving correctly - and may also impact post-install processes if you are installing software in the container.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Alex<br></blockquote><div><br></div><div>Cheers,</div><div>Ben</div></div></div>