Podman changes ownership of mounted directory to some numeric values

58 Views Asked by At

I can't understand podman in rootless mode. When I mount a directory inside a container, it doesn't matter what parameters I pass, files inside this directory on the host are owned by a number (which I think it's a subuid of my user, but I'm not sure).

As an example, let's consider an image called prowlarr. I'm running this image from the podman user which has id 1002:

[podman@homeserver ~]$ id
uid=1002(podman) gid=1002(podman) groups=1002(podman) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

With this image, I can pass both an UID and a GID (via environment variables) and in fact the main user (abc) inside the container has that id:

[podman@homeserver ~]$ podman exec -it prowlarr bash
root@ea40fb55c66c:/# cat /etc/passwd
root:x:0:0:root:/root:/bin/ash
...
abc:x:1002:1002::/config:/bin/false

Now, from the host point of view, this is the situation:

[podman@homeserver ~]$ cd prowlarr/
[podman@homeserver prowlarr]$ ls -l
total 4
drwxrwxr-x. 5 232073 232073 4096 Jan  9 15:11 config

Why is the config folder owned by 232073 and not by podman?

I tried to pass parameter UserNS=keep-id:uid=1002,gid=1002 and the container doesn't start.

When I try to pass parameter UserNS=keep-id, same as above: the container doesn't start.

What am I doing wrong? I don't want podman to change the ownership of mounted folders. They should stay under user podman ownership.

PS: I tried to read all other posts about this argument here and elsewhere but still, I can't understand what I'm doing wrong.

0

There are 0 best solutions below