Some beginner questions...

Alexander Neundorf neundorf at kde.org
Sat Mar 5 19:01:05 GMT 2022


On Samstag, 5. März 2022 19:11:53 CET Ben Cooksley wrote:
> On Sun, Mar 6, 2022 at 6:17 AM Alexander Neundorf <neundorf at kde.org> wrote:
> > On Sonntag, 21. November 2021 21:38:14 CET Albert Astals Cid wrote:
> > > El diumenge, 21 de novembre de 2021, a les 18:20:08 (CET), Alexander
> > 
> > Neundorf va escriure:
> > ...
> > 
> > > > Is there a reason why less, vi and mc are not part of the image ?
> > > > They make working in the container much nicer :-)
> > > 
> > > You can always
> > > 
> > >   sudo apt install vim
> > > 
> > > no?
> > 
> > I get errors:
> > I have no name!@8fdf0c048ce2:~$ sudo apt-get install vim
> > sudo: you do not exist in the passwd database
> > I have no name!@8fdf0c048ce2:~$
> 
> If you'd like to be root then something like this should work:
> 
> docker exec -u root $containerId /bin/bash
> 
> Bit unusual that you have managed to get a shell as a user account that
> does not exist, by default both our SUSE CI images and the Android CI image
> should run shells as root.
> The Android SDK image should spawn a shell as 'user' (UID 1000)

I mounted my host users src-directory into the container, so I need to have 
the same user- and group-ids in the container as on the host.
If I run as root in the container, I am also root on the directory which I 
mounted into the container, so if I touch something in the container, it's 
owned by root, also on the host.
Using the same user ID in the container as on the host makes that work 
smoothly (but then I'm not root and cannot install anything).
Then I can simply edit on the host using kate or whatever, and build in the 
container, and nothing is lost, neither sources nor build results.

Maybe during container startup the /etc/sudoers could be patched so that it 
allows the user who is running it can do sudo...

> > When mounting /etc/passwd into the container I get the following:
> > 
> > alex at 792716dfb133:~$ sudo apt-get install vim
> > [sudo] password for alex:
> > Sorry, try again.
> > [sudo] password for alex:
> > Sorry, try again.
> > [sudo] password for alex:
> > sudo: 3 incorrect password attempts
> 
> You will need to mount /etc/shadow in as well for your password to come
> through.
> I wouldn't recommend mounting either file into the container though.

They are mounted read-only, I'm using that since years for other purposes 
without problems. What issues do you see ?


Alex





More information about the KDE-Android mailing list