Hi,
Yeah, I'm fairly sure that would work, but am I to understand from your reply
that it is not possible to achieve with the UserNS quadlet option the things that the Remap* quadlet options did?
Correct. It's not possible.
If we just look at the use of --uidmap there is an enormous amount of
possibilities of how to map those.
Each container UID can be mapped to an arbitrary "intermediate UID"
but the mappings must be unique. By that I mean that different
container UIDs must not be mapped to the same intermediate UID. Also
different intermediate UIDs must not be mapped to the same container
UID. The number of possible ways of providing --uidmap corresponds to
a factorial in mathematics.
See how n! grows with n:
https://en.wikipedia.org/wiki/Factorial
The argument --userns=keep-id does not carry so much information. For instance
--userns=keep-id:uid=$uid,gid=$gid
can only be provided one time and has two numbers.
Another option to consider is
--userns=auto
but that option is quite different from --uidmap.
It provides different functionality.
The situation is a bit similar to static IP addresses vs dynamic IP
addresses in DHCP.
I see there is some discussion in
https://github.com/containers/podman/issues/17984
and
https://github.com/containers/podman/pull/17961
Erik
On Mon, Sep 4, 2023 at 9:46 PM jklaiho@iki.fi <jklaiho@iki.fi> wrote:
Hi Erik,
Yeah, I'm fairly sure that would work, but am I to understand from your reply that it is not possible to achieve with the UserNS quadlet option the things that the Remap* quadlet options did?
If so, why on earth did the Remap* options go away if a) they're still fully supported 'podman run' command-line options, and b) they serve a legit use case that UserNS doesn't fill?
- JK
On Monday, Sep 04, 2023 at 10:36 PM, Erik Sjölund <erik.sjolund@gmail.com> wrote:
I think the directive "PodmanArgs" can be used to set podman arguments
that don't have any
container option counterpart.
See man page:
https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
Maybe something like this could work?
PodmanArgs=--uidmap 0:0:1 --uidmap 100:1:1 --gidmap 0:0:1 --gidmap 65534:1:1
(untested)
Erik