-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Podman in podman as rootless user? #3917
Comments
I think you'll have to use the VFS storage driver inside the second container; I don't think fuse-overlay enjoys being layered. Also, you'll probably only have the use of 1 UID/GID in the inner container, and you'll have to use the ignore chown errors storage option to make that possible. It may be feasible to get newuidmap/newgidmap running inside the rootless container with appropriate mappings to make the inner rootless container use the same UIDs/GIDs as the other container, but I don't know if that's ever been tried before. Seccomp is definitely going to prevent you from doing this, so you'll have to disable it on the outer container with |
In short, I think this has been tried, and it can probably be made to work - but there will be serious limitations, I think. |
this is not a supported use case (yet), but if you want to play with it:
|
I've been playing around with the flags @giuseppe suggested, but wasn't able to get it to work. I'm leaving this issue open. |
Running root podman in a rootless podman is not possible at the moment, it's also not possible to run root podman in a root container without --privileged, due to the fact that root podman requires to create tmpfs (if using vfs) and to write to /sys/fs/cgroup. Podman can be run in podman by the following, but there is no benefit to do this, because running privileged with root podman is almost equivalent of host root. |
I think the only access you need is SYS_ADMIN capability, rather then --privileged. But I have not tried. And SYS_ADMIN is one of the most powerful capabilities. Bottom line podman command will attempt to do some mount commands and other functions that are not allowed without CAP_SYS_ADMIN |
I tried with CAP_SYS_ADMIN but it failed to write to /sys/fs/cgroup. I imagine podman in podman use case is only for testing, though it'll be nice to have zero impacts on the host OS. Of course if it's possible, running the rootless podman inside rootless podman is the best, but I think we are still far from it considering the fact that we can't run rootless podman in root podman yet without privileged option. |
Could you give me some examples of what you would like to run within a root container? |
I'm trying to run /bin/ash from alpine, like the example above.
In summary, I think the current state is...
|
I think that we can convince rootless podman to run within a non privileged root podman, but their needs to be a bit of configuration to make sure it uses fuse-overlayfs and has proper settings on its cgroup-manager and others. When you run rootless podman as non root user, then you get less access then you get with a rootfull non privileged container. @giuseppe Do you agree, this should be possible? |
Yes, I think ability to run rootless podman within a root non-privileged container would be great. It would also give an option to run podman in other container engines without being privileged. It would also probably mean, with buildah we no longer have to use chroot mode. |
A real world example is when you want to integrate image creation in CI/CD workflows which are typically governed by container runners these days. For example when trying to use podman/buildah within the context of a gitlab runner the CI scripts run in a container that will use buildah to construct a new container. For security reasons the outer container should be rootless. I'm currently trying to implement this and it looks like I cannot get any setup with an external rootless container to work. :/ |
Building an image with buildah in a rootless container is possible by following the link I posted.
But this buildah has to be run as root in the rootless container. Ability to run rootless podman in a rootless podman container is very slick, if that's what you are trying to achieve. @axelthimm |
Thanks @smekkley, that seems to work nicely! I was following the link that you posted that was pulling buildah and ended with
I'm not sure how this differs from the recipe you sent in the previous comment, but I'll try to model the gitlab runner accordingly. Of course, in the long run having rootless-in-rootless would be the perfect solution, but already having the outer container run rootless is a huge win and at least satisfies the use case I described. Thanks! |
I would use quay.io/buildah/stable for your buildah inside of a rootless podman container. |
Probably you are missing |
BTW, I was doing some experimenting with podman in a locked down Podman container, on Friday. Made some progress, and sent information to podman.io mailing list. Will continue working and diagnosing what is going on next week. |
Any update on this? It'd be even great if podman was runnable in --add-cap=ALL environment, because it's far better than --privileged or mouting docker.socket in case of docker. I'm happy to test if it's in some branch. |
I think we might work with |
Was supporting |
I tried podman in rootless podman, but it doesn't work, yet. |
Yes, we are continuing to work on this. |
A friendly reminder that this issue had no activity for 30 days. |
This is all tied to the containers.conf PR. |
Closing in favor of #4131. They're all tied together, so we can consolidate the issues a bit. |
Changes as of 2022-04-21: - apply-podman-deltas: minor cleanup - buildah-tests.diff: deal with: . buildah containers#3894 (the registry one), which affected helpers.bash in a way that resulted in conflicts here; and . buildah containers#3917 (etchosts), which caused offset-only diffs with no conflicts - Reevaluate the bud skip list, and reenable some tests that seems to be passing now under podman: . bud with specified context ... . two tests that require a local registry (which buildah now runs) . bud with --cgroup-parent Signed-off-by: Ed Santiago <santiago@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
/kind feature
Description
I am trying to run a podman container inside another podman container (just like docker in docker) in rootless mode.
I was not able to find any helpful information on the web 😞
Actually, I would appreciate if someone can confirm if this is actually possible.
Steps to reproduce the issue:
I am running podman in Ubuntu 19.04.
Describe the results you expected:
Podman images command should properly list the images
Additional information you deem important (e.g. issue happens only occasionally):
If i run the container with the --privileged flag (which I'm not sure if gives root permissons or just full permissions over my user, as I run it from my user):
I get an error when listing the images, if try to list them again, everything seems to be working fine:
Also, if i try to run a container, I get:
Output of
podman version
:Ubuntu 19.04:
Fedora 30 (fedora:latest):
Output of
podman info --debug
:Ubuntu 19.04
Fedora 30
Package info (e.g. output of
rpm -q podman
orapt list podman
):Ubuntu 19.04:
Fedora 30:
The text was updated successfully, but these errors were encountered: