Skip to content
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

rootless containers with libpod #675

Closed
lukasheinrich opened this issue Apr 26, 2018 · 12 comments
Closed

rootless containers with libpod #675

lukasheinrich opened this issue Apr 26, 2018 · 12 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@lukasheinrich
Copy link

/kind feature

Description

Hi, is it possible to run rootless containers using libpod? I did not find a corresponding option in https://github.com/projectatomic/libpod/blob/master/docs/podman-run.1.md.

We're essentially looking for a solution that provides much of the Docker CLI to a unprivileged user on a shared academic cluster, without the user having to worry about low-level runc commands of unpacking the image, preparing the config.json (like we do currently with skopeo, umoci and friends). My understanding is libpod is what we're looking for, but lacks the rootless option.

e.g. a tool that wraps

image building

container execution

@giuseppe
Copy link
Member

currently not. The biggest issue is to get rootless support in containers/storage. The only driver that could currently work without requiring root access is vfs, and you could probably hack around something if you previously set an user namespace where the current user is mapped to root, and from there attempt to run podman.

I thought of adding a --rootfs option to podman run so that it could re-use an existing rootfs for running a container, this won't solve the "not worry about unpacking the image" part but would be a fairly easy first step to get non privileged users run containers without having to worry of the config.json file

@rhatdan
Copy link
Member

rhatdan commented Apr 26, 2018

I would say this is a long term goal. There is a long term goal of getting Overlay to work with rootless as well. Which I need to follow up on.
@giuseppe We should investigate this more, especially when/if buildah gains this access.
@nalind WDYT?

@mheon
Copy link
Member

mheon commented Apr 26, 2018

@giuseppe I'd love to see a way to specify that a Libpod container does not use an image-based root filesystem, and just respect whatever directory the user passes to us. That was an original goal of the library, but it was dropped early on to get things out the door faster.

@lukasheinrich
Copy link
Author

Hi @rhatdan thanks. Is there already a place on github or elsewhere, where rootless overlay is discussed / worked on?

As for pointing podman to already unpacked rootfs directories, that's also a nice possibility. This is currently one of the dominant way, for example, that singularity is used where images are distributed in a unpacked form using a globally cached filesystem (CERN VM FileSystem -- CVMFS) -- e.g. https://github.com/opensciencegrid/cvmfs-singularity-sync

@giuseppe
Copy link
Member

giuseppe commented Apr 26, 2018

@lukasheinrich I've hacked something together here: https://github.com/giuseppe/libpod/tree/rootfs

It is incomplete and I am not really happy how the API looks like (the image name arg becomes argv0) and we need to discuss it. Anyway, it is the first step to make it usable with a non privileged user:

# podman run --rm --rootfs /some/where/rootfs echo hello
hello

@mheon
Copy link
Member

mheon commented Apr 26, 2018

@giuseppe Suggestion there - instead of patching CreateContainerStore, you'll probably have better luck changing setupStorage/teardownStorage/mount/unmount in container_internal.go to be no-ops if we're creating from a rootfs and not an image.

@rhatdan
Copy link
Member

rhatdan commented Apr 26, 2018

@lukasheinrich Internal emails discussing the steps to make Overlay Safe enough to allow non priv users to mount them. Talked to Eric Biederman and Storage Engineers at Red Hat.

@giuseppe
Copy link
Member

giuseppe commented Apr 27, 2018

I'd like to work on this once userNS support lands in as some of the added code is duplicated to get the userNS part working.

I've some WIP but it requires a change in conmon (the runc-wrapper script is to circumvent this limitation):

https://github.com/giuseppe/libpod/tree/rootfs-rootless

I could do something like:

$ cat /tmp/runc-wrapper
#!/bin/sh
XDG_RUNTIME_DIR=/run/user/$(id -u) /usr/bin/runc $@

$ id -u
1000

$ bin/podman --runtime /tmp/runc-wrapper --root /tmp/container/root --tmpdir /tmp/container/tmpdir run  --network host --rm --rootfs path/to/the/exploded/rootfs  echo hello
hello

EDIT:
the workaround for runc is not needed, I've amended a fix in my WIP that doesn't require it

@rhatdan
Copy link
Member

rhatdan commented Apr 27, 2018

Looks great.

@wking
Copy link
Contributor

wking commented May 17, 2018

The biggest issue is to get rootless support in containers/storage.

The open issue for that is containers/storage#96.

@rhatdan
Copy link
Member

rhatdan commented Jun 4, 2018

#871

@rhatdan
Copy link
Member

rhatdan commented Jul 12, 2018

This is continuing to be worked on, but there is some support, so I am closing this issue.

@rhatdan rhatdan closed this as completed Jul 12, 2018
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants