-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts/container.sh: support podman on macOS #2862
Conversation
The default user and group IDs on macOS are different from those used on Linux, so add the expected ones explicitly. Signed-off-by: Stefan Weil <[email protected]>
The goal is very simple: the script should work. The container creates a user "gluon". That user is the first one in a Linux environment which assigns UID 1000 and GID 1000. "gluon" must have r/w access to the gluon directories from outside. This can be achieved by mapping UID and GID of the user who is running the script to 1000 inside the container. See documentation for Without my patch a user with a UID != 1000 cannot use the script because then the container's "gluon" user would not have the same rights like the outside user. This is always a problem on macOS, but I expect that there would also be a similar problem on Linux. |
This change makes sense, but looking at the man page, it seems that the extended keep-id syntax was only introduced recently, breaking support for Podman on Ubuntu 22.04 and Debian Stable. I managed to get a similar effect by replacing |
The suggestion will indeed not work on Ubuntu 22.04 and return the error: Using the suggested approach above: $ id
uid=1001(ubuntu) gid=1001(ubuntu) groups=1001(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),119(netdev),120(lxd)
$ ./scripts/container.sh
...
Error: error creating container storage: error creating an ID-mapped copy of layer "63e29016d54128596c149fd94e94a725ca7e47b73b49dd1aff1ee19c858cc591": exit status 1: error during chown: error mapping container ID pair idtools.IDPair{UID:1001, GID:1001} for "usr/local/bin/editorconfig-checker" to host: Container ID 1001 cannot be mapped to a host ID I assume it is caused by the usernamespace mapping (subuid, subgid). I don't see here any easy solution without involving the current UID ( |
@NeoRaider, thank you for pointing out that my change requires a recent podman and won't work with Debian stable or Ubuntu LTS. @AiyionPrime, I suggest to merge PR #2868 which should work with all current podman versions and which also addresses docker. Therefore I close my own pull request. |
I actually like the podman-specific solution better than #2868, as it doesn't require building the container specifically for a single UID/GID. |
Hmm, is there any reason why we need the build user to be in |
That's correct. Removing the |
The default user and group IDs on macOS are different from those used on Linux, so add the expected ones explicitly.