action-env/oci-runner
Vitaliy Potyarkin bc7e4fecbd
All checks were successful
/ build-dotnet-8.0 (push) Successful in 3m13s
/ build-oci-image-builder-bookworm (push) Successful in 3m36s
/ build-oci-runner (push) Successful in 5m17s
/ build-openjdk-11-maven-3.8.6 (push) Successful in 3m10s
/ build-python-3.11 (push) Successful in 3m18s
/ build-python-3.13 (push) Successful in 2m52s
[#6] oci-runner: Use non-standard socket path to avoid collisions
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-12-26 17:44:44 +03:00
..
containers.conf [#6] oci-runner: Environment for launching nested containers 2024-12-26 14:59:22 +03:00
Dockerfile [#6] oci-runner: Use non-standard socket path to avoid collisions 2024-12-26 17:44:44 +03:00
README.md [#6] oci-runner: Environment for launching nested containers 2024-12-26 14:59:22 +03:00
registries.conf [#6] oci-runner: Environment for launching nested containers 2024-12-26 14:59:22 +03:00
storage.conf [#6] oci-runner: Environment for launching nested containers 2024-12-26 14:59:22 +03:00

Forgejo Actions environment for launching nested OCI containers

This image contains everything we need for executing tests which spawn nested containers:

  • Go toolchain
  • Docker wrapper (for abstracting Podman away from users)
  • Podman configuration files

Usage

Referencing this container from .forgejo/workflows/workflow.yml:

jobs:
  oci-image:
    runs-on: oci-runner

Privileges

Managing network connectivity between nested containers requires extra privileges on the outer container:

  • CAP_NET_ADMIN (fixes netavark: Netlink error: Operation not permitted)
  • CAP_SYS_ADMIN (fixes slirp4netns failed: "open(/dev/net/tun): No such file or directory)

These privileges are not required for running a single container inside rootless Podman. Use --net=host --uts=host --pid=host --cgroups=enabled to launch inner containers then.

Example of privileged outer container:

podman run \
    --cap-add CAP_NET_ADMIN --cap-add CAP_SYS_ADMIN \
    --rm -it git.frostfs.info/truecloudlab/env:oci-runner \
    podman run --name hi hello-world

Unprivileged outer container:

podman run \
    --rm -it git.frostfs.info/truecloudlab/env:oci-runner \
    podman run --net=host --uts=host --pid=host --cgroups=enabled hello-world