From 909fc632b3cb62aebe6d440e73a9471e1a041eaa Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Sat, 24 Dec 2022 14:01:18 -0500 Subject: [PATCH 1/2] WIP: update moby run to work with containers two things need to change when we're running docker in a virtual environment (LXC/D): first, we shouldn't test for the loop module, which might not exist/be loadable within the container. Second, we need a different cgroup mount command. This PR is blocked on https://github.com/void-linux/void-runit/pull/101 since the virtualization detection is currently incorrect for recent versions of LXD. Once https://github.com/void-linux/void-runit/pull/101 is merged, I'll remove the WIP designator. --- srcpkgs/moby/files/docker/run | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/srcpkgs/moby/files/docker/run b/srcpkgs/moby/files/docker/run index ed42f5fa72f8..724e5bc13228 100644 --- a/srcpkgs/moby/files/docker/run +++ b/srcpkgs/moby/files/docker/run @@ -1,8 +1,13 @@ #!/bin/sh [ -r conf ] && . ./conf -modprobe -q loop || exit 1 -mountpoint -q /sys/fs/cgroup/systemd || { - mkdir -p /sys/fs/cgroup/systemd; - mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd; -} +[ -r /etc/runit/functions ] && . /etc/runit/functions && detect_virt +if [ -z $VIRTUALIZATION ]; then # we're not in a container + modprobe -q loop || exit 1 + mountpoint -q /sys/fs/cgroup/systemd || { + mkdir -p /sys/fs/cgroup/systemd; + mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd; + } +else + mount -t cgroup2 cgroup2 /sys/fs/cgroup/ +fi exec chpst -o 1048576 -p 1048576 dockerd $OPTS 2>&1 From 07aea324442ae7b492508885d87bb7e8dba96853 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Sat, 24 Dec 2022 16:42:52 -0500 Subject: [PATCH 2/2] Update run Changed based on https://github.com/void-linux/void-runit/pull/102 --- srcpkgs/moby/files/docker/run | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srcpkgs/moby/files/docker/run b/srcpkgs/moby/files/docker/run index 724e5bc13228..a1ebdf9e23dc 100644 --- a/srcpkgs/moby/files/docker/run +++ b/srcpkgs/moby/files/docker/run @@ -1,7 +1,6 @@ #!/bin/sh [ -r conf ] && . ./conf -[ -r /etc/runit/functions ] && . /etc/runit/functions && detect_virt -if [ -z $VIRTUALIZATION ]; then # we're not in a container +if [[ $VIRTUALIZATION -ne 1 ]]; then # we're not in a container modprobe -q loop || exit 1 mountpoint -q /sys/fs/cgroup/systemd || { mkdir -p /sys/fs/cgroup/systemd;