Github messages for voidlinux
 help / color / mirror / Atom feed
From: sbromberger <sbromberger@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] WIP: update moby run to work with containers
Date: Sat, 24 Dec 2022 22:42:56 +0100	[thread overview]
Message-ID: <20221224214256.dazLcZIK9GJYFyrR8N3ihw3cQD_Tx732kve2v8iZBPE@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-41273@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

There is an updated pull request by sbromberger against master on the void-packages repository

https://github.com/sbromberger/void-packages patch-2
https://github.com/void-linux/void-packages/pull/41273

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.

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES** - but note - they've only been tested in virtual environments (I don't have docker running on bare metal void).


#### Local build testing
- I built this PR locally for my native architecture, `Linux lithium 6.0.13_1 #1 SMP PREEMPT_DYNAMIC Fri Dec 16 02:05:26 UTC 2022 x86_64 GNU/Linux` (glibc)



A patch file from https://github.com/void-linux/void-packages/pull/41273.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-patch-2-41273.patch --]
[-- Type: text/x-diff, Size: 2629 bytes --]

From 909fc632b3cb62aebe6d440e73a9471e1a041eaa Mon Sep 17 00:00:00 2001
From: Seth Bromberger <sbromberger@users.noreply.github.com>
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 <sbromberger@users.noreply.github.com>
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;

  reply	other threads:[~2022-12-24 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-24 19:04 [PR PATCH] " sbromberger
2022-12-24 21:42 ` sbromberger [this message]
2023-03-25  1:52 ` github-actions
2023-04-09  1:52 ` [PR PATCH] [Closed]: " github-actions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221224214256.dazLcZIK9GJYFyrR8N3ihw3cQD_Tx732kve2v8iZBPE@z \
    --to=sbromberger@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).