-
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
userns: add new option --userns=keep-id #3196
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Giuseppe Scrivano <[email protected]>
@debarshiray if you have a chance, could you try if it helps with fedora-toolbox? |
Can you add an environment variable to make this the default. |
could it be in the configuration file? |
Podman does not have a configuration file, (Well not one I want to expose.) Currently we change defaults via environment variables. |
I've added a patch where you can override the
|
cmd/podman/shared/create.go
Outdated
@@ -450,6 +451,12 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod. | |||
|
|||
// USER | |||
user := c.String("user") | |||
if usernsMode.IsKeepID() { | |||
if user != "" { | |||
return nil, errors.Errorf("cannot specify --user with --userns=keep-id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary?
Currently the toolbox
script uses podman create --user root:root --userns=keep-id ...
. The --user root:root
is for the container's entry point process, which calls useradd
, sets up the symlinks for /etc/resolv.conf
, etc. and needs to run as root
inside the container.. The --userns=keep-id
is used so that an interactive shell spawned via podman exec
runs as the same UID as the host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm no, I will relax this limitation if it is causing problems to toolbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check the new version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's fine now. Thanks.
**--userns**=ns:my_namespace | ||
|
||
Set the user namespace mode for the container. The use of userns is disabled by default. | ||
Set the user namespace mode for the container. It defaults to the **PODMAN_USERNS** environment variable. An empty value means user namespaces are disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you take create comments, ditto here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed both
Rootless tests look like they need some love still. |
it creates a namespace where the current UID:GID on the host is mapped to the same UID:GID in the container. Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano <[email protected]>
/lgtm |
@giuseppe what happens when you do a |
it creates a namespace where the current UID:GID on the host is mapped to the same UID:GID in the container.
Signed-off-by: Giuseppe Scrivano [email protected]