containers / containers/crun

Support podman exec in krun

Open
#2,090 9 comments 8 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4.1k
Forks
444
Avg merge
1d 18h
Merged PRs (30d)
43

Description

The krun backend does not support exec for "obvious" reasons (there is no existing mechanism for launching executables into the microVM). However, such a mechanism could be built. `muvm` is already doing something similar (cc @slp).

My motivation was using krun to run Forgejo runners and get a full GitHub Actions-style VM capable of running rootful podman/docker/everything else inside a rootless unprivileged container without running into corner cases. I thought I was being all clever and manually testing the concept worked perfectly (except for #2080):

```
[forgejo-runner@runner ~]$ podman --runtime krun run podman sh -c 'id; podman run --mount type=bind,source=/dev/null,target=/dev/mqueue alpine id'
uid=0(root) gid=0(root) groups=0(root)
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob sha256:6a0ac1617861a677b045b7ff88545213ec31c0ff08763195a70a4a5adda577bb
Copying config sha256:3cb067eab609612d81b4d82ff8ad71d73482bb3059a87b642d7e14f0ed659cde
Writing manifest to image destination
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
```

But alas, when I actually plugged it into forgejo-runner:

Image

Has this been considered before? libkrun already has an init binary and it could (optionally) fork off a server to handle `exec` commands, communicating via a vsocket or vport pair.

Aside: rootful-in-rootless also hits #2080, so that might be worth doing a release soon. This is the incantation required for non-krun rootful in rootless:

```
podman run --device /dev/fuse --security-opt unmask=ALL podman sh -c 'id; podman run --mount type=bind,source=/dev/null,target=/dev/mqueue alpine id'
uid=0(root) gid=0(root) groups=0(root)
[...]
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.