-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Read PODMAN_USERNS env variable when creating containers through compose API #11350
Comments
Thanks for reaching out! It looks like @rhatdan started working on it: rhatdan@a61ab18 |
Wow I'm impressed, that was quick! Thanks @vrothberg and @rhatdan! Let me know if there's anything I can do to help 👍 |
A friendly reminder that this issue had no activity for 30 days. |
Friendly ping @rhatdan. Looks like you've been working on the issue in October. |
A friendly reminder that this issue had no activity for 30 days. |
Fixes: containers#11350 (comment) Also add inspect information about the idmappings if they exists. Signed-off-by: Daniel J Walsh <[email protected]>
Fixes: containers#11350 (comment) Also add inspect information about the idmappings if they exists. Signed-off-by: Daniel J Walsh <[email protected]>
I just recently tested this fix and it's indeed working. Thanks @rhatdan for working on it! 🙏 For those who might want to use it, you can simply add a drop-in in the podman user service like that: Add this to
Then And with this last touch you will get export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock" |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Running or creating containers from API is not consistent with creating them through the
podman cli
. Specifically, thePODMAN_USERNS
environment variable for thepodman system service
is completely ignored and therefore you can't set a value as the default for that configuration.The impact is for running rootless Podman + docker-compose, I can't have a similar experience as I would have with Docker + compose.
Steps to reproduce the issue:
Install docker-compose
Configure podman to run as rootless.
Start podman system service (through
systemctl enable --now --user podman.socket
)Run
docker-compose run --rm testservice ls -lah /srv
using thedocker-compose.yml
below:Describe the results you received:
You will see the list of files of your current directory as if they're owned by root. This is expected by a rootless container, however there's no way of turning it off, as you would have if you used this command:
There's no support for setting
userns
in docker-compose to the value ofkeep-id
, which is the option that allows us to disable the root mapping. I understand though, that this is a limitation ofdocker-compose
anddocker-py
themselves (you can setuserns_mode
but only to the value ofhost
, which is supported by Docker engine).Describe the results you expected:
The implementation of
userns
(#3196) allowed us to set a global environment variablePODMAN_USERNS
and then all containers created throughpodman run/create
would have the userns set to the value of that variable. This does not happen, however, if you try to create the container through the Docker compose API. By using the API, you are required to send theHostConfig.UserNSMode
parameter every time, so there's no concept of defaulting to env var. Therefore I couldn't even set that environment variable before running the server, because it will be ignored.Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
I'm running it locally.
The text was updated successfully, but these errors were encountered: