help getting clarity on how userns mappings work #27845
-
|
I am trying to run an alpine container with postfix. This is the Containerfile: FROM alpine:3.21
RUN apk update && \
apk add --no-cache \
postfix=~{{ postfix.version }} \
postfix-pcre=~{{ postfix.version }}
CMD ["postfix", "-v", "start-fg"]After running it once (with a regular user), I see that postfix starts as UID 0 (root) to then switch to UID 100 (postfix), GID 101. When running it with "userns=host" it works, but when running it as "userns=keep-id:uid=100,gid=101" I am getting an error: My understanding from the documentation is that by using "userns=keep-id:uid=100,gid=101", podman would map my user (993:980) to that of the postfix user inside the container (100:101). But I am missing something because if this was the case... the application would not see anything different, right? Considering I am using different users for different containers, how problematic is to use userns=host, besides the fact that the files created by the user 100 on the container will be owned by the corresponding subuid on the host? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Does it work if you also pass A general tip: when using |
Beta Was this translation helpful? Give feedback.
I think
--userns=keep-id:uid=100,gid=101is trying to be helpful but in this case changing--useris not what we want.I think it might be less confusing to use
because those options do not change
--user