podman: Add support for rootless mode

This support is disabled by default and exposed via PACKAGECONFIG.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Andrei Gherzan 2022-07-11 20:53:04 +02:00 committed by Bruce Ashfield
parent 2e05df2f43
commit cf8a763b28
5 changed files with 36 additions and 1 deletions

View File

@ -11,5 +11,8 @@ alphabetical order as well.
openvswitch.txt
- example on how to setup openvswitch with qemu/kvm.
podman.txt
- documentation on podman container engine integration.
xvisor.txt
- example on how to setup Xvisor for RISC-V QEMU.

14
docs/podman.txt Normal file
View File

@ -0,0 +1,14 @@
Podman
======
Rootless mode
-------------
Podman is a daemonless container engine that has as one of its features the
ability to run in rootless mode. This requires a set of configurations and
additional components. The OE/Yocto integration configures podman with this
support disabled by default. This can be changed via configuration files
(distro, local.conf, etc.) or bbappends using the `PACKAGECONFIG` variable.
To enable rootless support, add `rootless` to the `PACKAGECONFIG` podman
recipe variable.

3
docs/podman.txt.license Normal file
View File

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: Huawei Inc.
SPDX-License-Identifier: MIT

View File

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: MIT
# User namespaces are required for rootless containers.
user.max_user_namespaces = 15000

View File

@ -21,6 +21,7 @@ SRCREV = "cedbbfa543651a13055a1fe093a4d0a2a28ccdfd"
SRC_URI = " \
git://github.com/containers/libpod.git;branch=v4.1;protocol=https \
file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \
${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'file://00-podman-rootless.conf', '', d)} \
"
LICENSE = "Apache-2.0"
@ -97,6 +98,11 @@ do_install() {
# Silence docker emulation warnings.
mkdir -p ${D}/etc/containers
touch ${D}/etc/containers/nodocker
if ${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'true', 'false', d)}; then
install -d "${D}${sysconfdir}/sysctl.d"
install -m 0644 "${WORKDIR}/00-podman-rootless.conf" "${D}${sysconfdir}/sysctl.d"
fi
}
FILES:${PN} += " \
@ -112,6 +118,9 @@ SYSTEMD_SERVICE:${PN} = "podman.service podman.socket"
# that busybox is configured with nsenter
VIRTUAL-RUNTIME_base-utils-nsenter ?= "util-linux-nsenter"
RDEPENDS:${PN} += "conmon virtual-runc iptables cni skopeo ${VIRTUAL-RUNTIME_base-utils-nsenter}"
RDEPENDS:${PN} += "\
conmon virtual-runc iptables cni skopeo ${VIRTUAL-RUNTIME_base-utils-nsenter} \
${@bb.utils.contains('PACKAGECONFIG', 'rootless', 'fuse-overlayfs slirp4netns', '', d)} \
"
RRECOMMENDS:${PN} += "slirp4netns kernel-module-xt-masquerade kernel-module-xt-comment"
RCONFLICTS:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'docker', '', d)}"