From ee13367e223e114ee2a63b32c61afab0409592f4 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Thu, 24 Apr 2025 16:30:47 -0700 Subject: [PATCH] systemd/systemd-services: add docker-engine/dockerd and containerd unit files fixes #3679 Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6450 [ci:skip-build]: already built successfully in CI --- extra-repos/systemd/systemd-services/APKBUILD | 15 ++++-- .../system-containerd.service | 41 +++++++++++++++++ .../systemd-services/system-docker.service | 46 +++++++++++++++++++ .../systemd-services/system-docker.socket | 13 ++++++ 4 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 extra-repos/systemd/systemd-services/system-containerd.service create mode 100644 extra-repos/systemd/systemd-services/system-docker.service create mode 100644 extra-repos/systemd/systemd-services/system-docker.socket diff --git a/extra-repos/systemd/systemd-services/APKBUILD b/extra-repos/systemd/systemd-services/APKBUILD index 18f21bca4..36bc82560 100644 --- a/extra-repos/systemd/systemd-services/APKBUILD +++ b/extra-repos/systemd/systemd-services/APKBUILD @@ -7,8 +7,8 @@ # How to add a new service file (5 steps): pkgname=systemd-services # 1. bump pkgver -pkgver=67 -pkgrel=2 +pkgver=68 +pkgrel=0 pkgdesc="Systemd service files" url="https://postmarketos.org" arch="noarch" @@ -30,8 +30,10 @@ subpackages=" bluez-systemd:_service colord-systemd:_service connman-systemd:_service - dconf-systemd:_service + containerd-systemd:_service cosmic-greeter-systemd:_service + dconf-systemd:_service + docker-engine-systemd:_service eg25-manager-systemd:_service evolution-data-server-systemd:_service feedbackd-systemd:_service @@ -114,8 +116,10 @@ _connman_sources=" system/connman-wait-online.service system/connman.service " # From connman upstream +_containerd_sources="system/containerd.service" # From: https://github.com/containerd/containerd/blob/main/containerd.service _cosmic_greeter_sources="system/cosmic-greeter.service system/cosmic-greeter-daemon.service" # From https://github.com/pop-os/cosmic-greeter/tree/master/debian _dconf_sources="user/dconf.service" +_docker_engine_sources="system/docker.service system/docker.socket" # From https://github.com/moby/moby/blob/master/contrib/init/systemd _eg25_manager_sources="system/eg25-manager.service" # From https://gitlab.com/mobian1/eg25-manager/-/blob/master/data/eg25-manager.service.in _evolution_data_server_sources=" user/evolution-addressbook-factory.service @@ -218,8 +222,10 @@ source="$(flatpath \ $_bluez_sources \ $_colord_sources \ $_connman_sources \ + $_containerd_sources \ $_cosmic_greeter_sources \ $_dconf_sources \ + $_docker_engine_sources \ $_eg25_manager_sources \ $_evolution_data_server_sources \ $_feedbackd_sources \ @@ -334,9 +340,12 @@ c10378bac1d64c0a2c767aab439c7d71bb7706b4fdc981add3ab4d5967257c0177f07448f884aeb1 52840a212a845900ed88bd08a7b318c2b74c68a421bf1a9bbb3378e09be2b6edab1ddb87a3e410925ab0f50ab738ab3c804611bdf8101ca7896e874f9f6ba066 system-connman-vpn.service a7fd0c47858a10c263d9bc661dc955366a2acd79f7be5cf2571dc7ec3b3f5adf122b4e55e58d01b778aa7ed0c6981fc454295c93d29bd89d9145d5d2439e01a5 system-connman-wait-online.service 9e2bb4153e97c11db7792b758a7a21bd352c7443dbdbde0f390d4dfe52d7495a4a01cb15097e842cfe69eb1214f9bca5a626fb54b4f8216e11efda1c55b89add system-connman.service +b7cc164dc0520652df9b2bf6f9708b7230bc6a3274d02ce222ba507f94bf31e3125532cf806af7ca0084c8b286b7dcefbc2cffe42a901a9e58c56e145d365fed system-containerd.service 4c64d433da3999c4f778c379e67779b30370b3a06ee09f22eaa594ce68f948afe2d3827c254ddf4b53341b394718eb5e29d242d2db5209e87084502cb581cac8 system-cosmic-greeter.service 0da725086569f336593f52de6e61fa34482522bd83cd477c3a8de610813c9a96278d94b59d84e2ce9fc3605f893a4e2708f2cf9452aae6c4cfe2ffca54c91e2c system-cosmic-greeter-daemon.service e4de73d12abd046c8683e3be6e3aab40a5db3f5d6246cedbb3ff099bcc8037a167b23ac957d30f1118db571b69cb10c042272ac2b54dacf83fa6a3e9dad13a87 user-dconf.service +1189ada8b126b2e574aea2e9b3ad9b0a86282d82be4f4ad4c58b1d968ce15ff45e8c60108f5e128ee946aa7e6e57f9fbb0b5d31d8371e79a2f0b3f3456bbd65f system-docker.service +c2d1f2a55bd7eed5a296e14b3250baa2f568dbdbce4444bae4635c1ce4bd6d3f1036462926d8c32d62d6609f5fcfb58933bf7eeb1924aefd814e864bc77bb7c7 system-docker.socket 780912dbfdc7e9a350e934d46022b043edda86a393a7c107d0c855e9580240e4bce791428fdadef0a45adc6cfa24fb5d58981b6ccd80e3dad99da3e5fa3dc7b8 system-eg25-manager.service 73e1839cec077e35ed985891f5274a09816115cc083e7a6e7e1fd98c88f4a114d7353492dee5808a28c47bf06bca32d9a6a7cc833cf4f21e501774955e93b321 user-evolution-addressbook-factory.service c648760e50e0c47970cce8fdd1972864af74bbc979ed4366973bf1c923ee624779bea95cf1e54260c55fa8a069090a367ceabe9b240842e20959bca42f2f8043 user-evolution-calendar-factory.service diff --git a/extra-repos/systemd/systemd-services/system-containerd.service b/extra-repos/systemd/systemd-services/system-containerd.service new file mode 100644 index 000000000..5d930139c --- /dev/null +++ b/extra-repos/systemd/systemd-services/system-containerd.service @@ -0,0 +1,41 @@ +# Copyright The containerd Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[Unit] +Description=containerd container runtime +Documentation=https://containerd.io +After=network.target dbus.service + +[Service] +ExecStartPre=-/sbin/modprobe overlay +ExecStart=/usr/bin/containerd + +Type=notify +Delegate=yes +KillMode=process +Restart=always +RestartSec=5 + +# Having non-zero Limit*s causes performance problems due to accounting overhead +# in the kernel. We recommend using cgroups to do container-local accounting. +LimitNPROC=infinity +LimitCORE=infinity + +# Comment TasksMax if your systemd version does not supports it. +# Only systemd 226 and above support this version. +TasksMax=infinity +OOMScoreAdjust=-999 + +[Install] +WantedBy=multi-user.target diff --git a/extra-repos/systemd/systemd-services/system-docker.service b/extra-repos/systemd/systemd-services/system-docker.service new file mode 100644 index 000000000..27317fac0 --- /dev/null +++ b/extra-repos/systemd/systemd-services/system-docker.service @@ -0,0 +1,46 @@ +[Unit] +Description=Docker Application Container Engine +Documentation=https://docs.docker.com +After=network-online.target nss-lookup.target docker.socket firewalld.service containerd.service time-set.target +Wants=network-online.target containerd.service +Requires=docker.socket + +[Service] +Type=notify +# the default is not to use systemd for cgroups because the delegate issues still +# exists and systemd currently does not support the cgroup feature set required +# for containers run by docker +ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock +ExecReload=/bin/kill -s HUP $MAINPID +TimeoutStartSec=0 +RestartSec=2 +Restart=always + +# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229. +# Both the old, and new location are accepted by systemd 229 and up, so using the old location +# to make them work for either version of systemd. +StartLimitBurst=3 + +# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230. +# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make +# this option work for either version of systemd. +StartLimitInterval=60s + +# Having non-zero Limit*s causes performance problems due to accounting overhead +# in the kernel. We recommend using cgroups to do container-local accounting. +LimitNPROC=infinity +LimitCORE=infinity + +# Comment TasksMax if your systemd version does not support it. +# Only systemd 226 and above support this option. +TasksMax=infinity + +# set delegate yes so that systemd does not reset the cgroups of docker containers +Delegate=yes + +# kill only the docker process, not all processes in the cgroup +KillMode=process +OOMScoreAdjust=-500 + +[Install] +WantedBy=multi-user.target diff --git a/extra-repos/systemd/systemd-services/system-docker.socket b/extra-repos/systemd/systemd-services/system-docker.socket new file mode 100644 index 000000000..c76a23296 --- /dev/null +++ b/extra-repos/systemd/systemd-services/system-docker.socket @@ -0,0 +1,13 @@ +[Unit] +Description=Docker Socket for the API + +[Socket] +# If /var/run is not implemented as a symlink to /run, you may need to +# specify ListenStream=/var/run/docker.sock instead. +ListenStream=/run/docker.sock +SocketMode=0660 +SocketUser=root +SocketGroup=docker + +[Install] +WantedBy=sockets.target