Github messages for voidlinux
 help / color / mirror / Atom feed
From: thetredev <thetredev@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] docker: Parameterize loading the loop kernel module
Date: Mon, 11 Mar 2024 01:25:15 +0100	[thread overview]
Message-ID: <20240311002515.04D7624C34@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46667@inbox.vuxu.org>

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

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

https://github.com/thetredev/void-packages docker/fix-wsl-service-startup
https://github.com/void-linux/void-packages/pull/46667

docker: Parameterize loading the loop kernel module
These changes introduce a config variable `LOAD_LOOP_MODULE` which can be set to `yes` (default) or `no` within the `/etc/docker/sv/conf` file.

#### Testing the changes
- I tested the changes in this PR: **YES** (`xlint docker` + `./xbps-src pkg -Q docker`)
- I tested that the Docker service is working when the `loop` kernel module is not required (e.g. under WSL): **YES** (see below)

```
PS C:\Users\Cheeba> wsl -u root bash -ic "cat /etc/sv/docker/conf"
cat: /etc/sv/docker/conf: No such file or directory
PS C:\Users\Cheeba> wsl -u root bash -ic "sv status docker"
down: docker: 1s, normally up, want up; run: log: (pid 170) 3s
PS C:\Users\Cheeba> wsl -u root bash -ic "sv restart docker"
timeout: down: docker: 1s, normally up, want up
PS C:\Users\Cheeba> wsl -u root bash -ic "vim /etc/sv/docker/conf"
PS C:\Users\Cheeba> wsl -u root bash -ic "cat /etc/sv/docker/conf"
LOAD_LOOP_MODULE=yes
PS C:\Users\Cheeba> wsl -u root bash -ic "sv restart docker"
timeout: down: docker: 1s, normally up, want up
PS C:\Users\Cheeba> wsl -u root bash -ic "sv status docker"
down: docker: 0s, normally up, want up; run: log: (pid 170) 35s
PS C:\Users\Cheeba> wsl -u root bash -ic "vim /etc/sv/docker/conf"
PS C:\Users\Cheeba> wsl -u root bash -ic "cat /etc/sv/docker/conf"
LOAD_LOOP_MODULE=no
PS C:\Users\Cheeba> wsl -u root bash -ic "sv restart docker"
ok: run: docker: (pid 479) 1s
PS C:\Users\Cheeba> wsl -u root bash -ic "sv status docker"
run: docker: (pid 479) 2s; run: log: (pid 170) 45s
PS C:\Users\Cheeba> wsl -u root bash -ic "docker ps"
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
PS C:\Users\Cheeba> wsl -u root bash -ic "docker version"
Client:
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.21.0
 Git commit:        tag v24.0.6
 Built:             Wed Sep  6 13:42:27 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.21.0
  Git commit:       tag v24.0.6
  Built:            Wed Sep  6 13:42:27 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.7
  GitCommit:        UNSET
 runc:
  Version:          1.1.9
  GitCommit:
 docker-init:
  Version:          0.19.0
  GitCommit:
PS C:\Users\Cheeba>
```

#### Motivation behind the changes

I played around with using Void Linux under WSL2 and struggled to get the Docker service started up. Eventually I realized that the `modprobe -q loop` command would *always* fail under WSL2, because there is no directory `/lib/modules`, so `modprobe` is essentially useless under WSL2. I think there are other mechanisms involved when loading the WSL2 kernel and modules. Either way, Docker runs very well with these changes.

I understand that Void Linux is not officially supported by Microsoft (and probably vice-versa), and there's manual steps involved installing it, but I thought why not make Docker run for everybody nonetheless?

These changes should make the Docker service run both when the `loop` module is available and has to be loaded (default), as well as in systems where it's not available or not required, like WSL2.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-docker/fix-wsl-service-startup-46667.patch --]
[-- Type: text/x-diff, Size: 1331 bytes --]

From 7a0e1291d3a4980f1259c77fac6997bfbaaca5df Mon Sep 17 00:00:00 2001
From: Timo Reichl <thetredev@gmail.com>
Date: Sat, 14 Oct 2023 18:11:24 +0200
Subject: [PATCH] docker: Parameterize loading the loop kernel module

Signed-off-by: Timo Reichl <thetredev@gmail.com>
---
 srcpkgs/moby/files/docker/run | 5 ++++-
 srcpkgs/moby/template         | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/moby/files/docker/run b/srcpkgs/moby/files/docker/run
index 959c22b803c587..386830059f7700 100644
--- a/srcpkgs/moby/files/docker/run
+++ b/srcpkgs/moby/files/docker/run
@@ -1,7 +1,10 @@
 #!/bin/sh
 exec 2>&1
 [ -r conf ] && . ./conf
-modprobe -q loop || exit 1
+case "${LOAD_LOOP_MODULE:-yes}" in
+    no) ;;
+    *) modprobe -q loop || exit 1 ;;
+esac
 mountpoint -q /sys/fs/cgroup/systemd || {
     mkdir -p /sys/fs/cgroup/systemd;
     mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd;
diff --git a/srcpkgs/moby/template b/srcpkgs/moby/template
index 2aa2e426b02597..1cfb875de630a3 100644
--- a/srcpkgs/moby/template
+++ b/srcpkgs/moby/template
@@ -2,7 +2,7 @@
 # should be kept in sync with docker-cli
 pkgname=moby
 version=25.0.3
-revision=1
+revision=2
 # libnetwork commit is mentioned in vendor.conf
 _libnetwork_commit=05b93e0d3a95952f70c113b0bc5bdb538d7afdd7
 create_wrksrc=yes

  parent reply	other threads:[~2024-03-11  0:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13 21:15 [PR PATCH] docker: Fix service startup under WSL2 thetredev
2023-10-14  7:31 ` classabbyamp
2023-10-14 12:27 ` thetredev
2023-10-14 14:56 ` ahesford
2023-10-14 14:56 ` [PR PATCH] [Closed]: " ahesford
2023-10-14 15:02 ` ahesford
2023-10-14 15:02 ` ahesford
2023-10-14 15:55 ` thetredev
2023-10-14 16:00 ` [PR PATCH] [Updated] " thetredev
2023-10-14 16:08 ` [PR REVIEW] docker: Parameterize loading the loop kernel module ahesford
2023-10-14 16:08 ` thetredev
2023-10-14 16:11 ` [PR PATCH] [Updated] " thetredev
2023-10-14 16:11 ` [PR REVIEW] " thetredev
2023-10-14 16:13 ` thetredev
2023-10-14 16:26 ` thetredev
2024-03-09 22:53 ` [PR PATCH] [Updated] " thetredev
2024-03-09 22:53 ` thetredev
2024-03-11  0:25 ` thetredev [this message]
2024-03-11  0:30 ` [PR PATCH] [Updated] " thetredev

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=20240311002515.04D7624C34@inbox.vuxu.org \
    --to=thetredev@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).