From af37d6f1d1c7a311946145aff560c21124c83a00 Mon Sep 17 00:00:00 2001 From: xiota Date: Wed, 11 Dec 2024 19:51:07 +0000 Subject: [PATCH] feat(docker-rootless-extras) --- docker-rootless-extras/.CI/config | 1 + docker-rootless-extras/.CI/info | 2 + docker-rootless-extras/.SRCINFO | 29 +++++++++++ .../99-docker-rootless.conf | 1 + docker-rootless-extras/PKGBUILD | 51 +++++++++++++++++++ .../docker-rootless-extras.install | 28 ++++++++++ docker-rootless-extras/docker.socket | 9 ++++ 7 files changed, 121 insertions(+) create mode 100644 docker-rootless-extras/.CI/config create mode 100644 docker-rootless-extras/.CI/info create mode 100644 docker-rootless-extras/.SRCINFO create mode 100644 docker-rootless-extras/99-docker-rootless.conf create mode 100644 docker-rootless-extras/PKGBUILD create mode 100644 docker-rootless-extras/docker-rootless-extras.install create mode 100644 docker-rootless-extras/docker.socket diff --git a/docker-rootless-extras/.CI/config b/docker-rootless-extras/.CI/config new file mode 100644 index 000000000..66bee9477 --- /dev/null +++ b/docker-rootless-extras/.CI/config @@ -0,0 +1 @@ +CI_PKGBUILD_SOURCE=aur diff --git a/docker-rootless-extras/.CI/info b/docker-rootless-extras/.CI/info new file mode 100644 index 000000000..4965fcc30 --- /dev/null +++ b/docker-rootless-extras/.CI/info @@ -0,0 +1,2 @@ +REQ_ORIGIN=github/3408 +REQ_REASON=request diff --git a/docker-rootless-extras/.SRCINFO b/docker-rootless-extras/.SRCINFO new file mode 100644 index 000000000..3fd5253ee --- /dev/null +++ b/docker-rootless-extras/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = docker-rootless-extras + pkgdesc = Extras to run docker as non-root. + pkgver = 27.4.0 + pkgrel = 1 + url = https://docs.docker.com/engine/security/rootless/ + install = docker-rootless-extras.install + arch = x86_64 + arch = aarch64 + license = Apache + depends = docker + depends = rootlesskit + depends = slirp4netns + optdepends = fuse-overlayfs: overlayfs support + provides = docker-rootless + provides = docker-rootless-extras + provides = docker-rootless-extras-bin + conflicts = docker-rootless + conflicts = docker-rootless-extras + conflicts = docker-rootless-extras-bin + source = dockerd-rootless-27.4.0.sh::https://raw.githubusercontent.com/moby/moby/v27.4.0/contrib/dockerd-rootless.sh + source = dockerd-rootless-setuptool-27.4.0.sh::https://raw.githubusercontent.com/moby/moby/v27.4.0/contrib/dockerd-rootless-setuptool.sh + source = docker.socket + source = 99-docker-rootless.conf + sha256sums = 5a4fcf228be8e5d2fd6c0676c858372a2afb95144675d02f215301272c344f65 + sha256sums = d6ddae456cc5ecdd5285035d24ad3546898872e5c4d407718ced0d4fa19031ff + sha256sums = d8695293e5d4a814763f13e1d36ed37273040666b4b91363d6c33171df8934c7 + sha256sums = d0d790d4c3d887b10b2b155b83a58a44980b9fa638f8c0f1faec0739dc0ef473 + +pkgname = docker-rootless-extras diff --git a/docker-rootless-extras/99-docker-rootless.conf b/docker-rootless-extras/99-docker-rootless.conf new file mode 100644 index 000000000..dec5a7731 --- /dev/null +++ b/docker-rootless-extras/99-docker-rootless.conf @@ -0,0 +1 @@ +kernel.unprivileged_userns_clone=1 diff --git a/docker-rootless-extras/PKGBUILD b/docker-rootless-extras/PKGBUILD new file mode 100644 index 000000000..980b57896 --- /dev/null +++ b/docker-rootless-extras/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: Ľubomír 'the-k' Kučera +# Contributor: Hugo Osvaldo Barrera +# Contributor: PastLeo +# Contributor: koba1t + +pkgname=docker-rootless-extras +pkgver=27.4.0 +pkgrel=1 +pkgdesc="Extras to run docker as non-root." +arch=('x86_64' 'aarch64') +url="https://docs.docker.com/engine/security/rootless/" +license=('Apache') +depends=('docker' 'rootlesskit' 'slirp4netns') +optdepends=('fuse-overlayfs: overlayfs support') +provides=('docker-rootless' 'docker-rootless-extras' 'docker-rootless-extras-bin') +conflicts=('docker-rootless' 'docker-rootless-extras' 'docker-rootless-extras-bin') +install=$pkgname.install +source=( + "dockerd-rootless-${pkgver}.sh::https://raw.githubusercontent.com/moby/moby/v${pkgver}/contrib/dockerd-rootless.sh" + "dockerd-rootless-setuptool-${pkgver}.sh::https://raw.githubusercontent.com/moby/moby/v${pkgver}/contrib/dockerd-rootless-setuptool.sh" + "docker.socket" + "99-docker-rootless.conf") + +sha256sums=('5a4fcf228be8e5d2fd6c0676c858372a2afb95144675d02f215301272c344f65' + 'd6ddae456cc5ecdd5285035d24ad3546898872e5c4d407718ced0d4fa19031ff' + 'd8695293e5d4a814763f13e1d36ed37273040666b4b91363d6c33171df8934c7' + 'd0d790d4c3d887b10b2b155b83a58a44980b9fa638f8c0f1faec0739dc0ef473') + +package() { + install -Dm755 "$srcdir/dockerd-rootless-${pkgver}.sh" "$pkgdir/usr/bin/dockerd-rootless.sh" + install -Dm644 "$srcdir/docker.socket" "$pkgdir/usr/lib/systemd/user/docker.socket" + install -Dm644 "$srcdir/99-docker-rootless.conf" "$pkgdir/usr/lib/sysctl.d/99-docker-rootless.conf" + + # The systemd service file is bundled inside the setup script. The script is + # unsuitable to run in this PKGBUILD, since it tampers with $HOME and other + # similar paths, so would mess up the environment for users who run + # `makepkg` on their host. + # TODO: Send a patch upstream so we can make the script JUST print this. + awk '/Unit/,/EOT/' "$srcdir/dockerd-rootless-setuptool-$pkgver.sh" \ + | head -n-1 \ + | sed 's/^[[:space:]]*//' \ + | sed 's|$BIN|/usr/bin|' \ + | sed 's|\\$MAINPID|$MAINPID|' \ + | sed 's| $DOCKERD_ROOTLESS_SH_FLAGS||' \ + > "$pkgdir/usr/lib/systemd/user/docker.service" + + # Remove the $PATH override, since this will be dependant on $PATH at build + # time and is usually undesirable. + # TODO: Patch this upstream. + sed -i '/Environment=PATH=/d' "$pkgdir/usr/lib/systemd/user/docker.service" +} diff --git a/docker-rootless-extras/docker-rootless-extras.install b/docker-rootless-extras/docker-rootless-extras.install new file mode 100644 index 000000000..98f8c3807 --- /dev/null +++ b/docker-rootless-extras/docker-rootless-extras.install @@ -0,0 +1,28 @@ +post_install() { + sysctl --system + cat <