Martin Schwenke has uploaded this change for review.

View Change

scripts: Try harder to create a matching user in the container

The container user needs to be able to write in the current directory,
so needs to have the same UID and GID as the invoking user. One
assumption that has worked for me so far is, as a developer, I'm
usually using a machine with me as the first created non-system
user (usually with UID 1000 and GID 1000). However, that might not be
true, so pass actual values and use them for the container user.

For some innovative reason, the standard Ubuntu 24.04 container image
has an "ubuntu" user with UID 1000 and GID 1000, so the above doesn't
work. Well, it does work with the -o option to useradd and groupadd,
but the username resolves to "ubuntu", so sudo doesn't work as
intended. So, unconditionally try to nuke the "ubuntu" user/group to
avoid this trauma.

If this gets harder, I'll replace this "logic" with a script that
jumps through hoops to ensure there is no pre-existing UID/GID
matching those passed, so it can create the desired user... and
everything works as intended. There are probably already several
GitHub projects for that script. ;-)

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Change-Id: I19430a89998758983bb49650c7db71c62d53467d
---
M src/scripts/podman/Containerfile
M src/scripts/podman/ganesha-container
2 files changed, 10 insertions(+), 2 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/58/1199258/1

To view, visit change 1199258. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I19430a89998758983bb49650c7db71c62d53467d
Gerrit-Change-Number: 1199258
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Schwenke <martin@meltin.net>