From c4c2d89b4e22ff484b08f138ca05b6098077590c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 20 May 2021 17:18:39 +0200 Subject: [PATCH] Use systemd unit files from upstream repository The packaging repository was maintaining its own version of the systemd units. These files were originally based on the units in the upstream docker / moby repository, but diverged. PR https://github.com/moby/moby/pull/42373 merged back the units from this repository to upstream, so we can now consume those files instead of the ones that were maintained in this repository. Signed-off-by: Sebastiaan van Stijn --- deb/Makefile | 10 +-------- deb/common/rules | 10 ++++----- rpm/Makefile | 10 +-------- rpm/SPECS/docker-ce.spec | 6 ++--- systemd/docker.service | 47 ---------------------------------------- systemd/docker.socket | 11 ---------- 6 files changed, 9 insertions(+), 85 deletions(-) delete mode 100644 systemd/docker.service delete mode 100644 systemd/docker.socket diff --git a/deb/Makefile b/deb/Makefile index 540bf2c3b9..7d859ba83d 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -77,7 +77,7 @@ $(DISTROS): sources $(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@" .PHONY: sources -sources: sources/cli.tgz sources/engine.tgz sources/scan-cli-plugin.tgz sources/docker.service sources/docker.socket sources/plugin-installers.tgz +sources: sources/cli.tgz sources/engine.tgz sources/scan-cli-plugin.tgz sources/plugin-installers.tgz sources/engine.tgz: mkdir -p $(@D) @@ -103,14 +103,6 @@ sources/scan-cli-plugin.tgz: alpine \ tar -C / -c -z -f /v/scan-cli-plugin.tgz --exclude .git scan-cli-plugin -sources/docker.service: ../systemd/docker.service - mkdir -p $(@D) - cp $< $@ - -sources/docker.socket: ../systemd/docker.socket - mkdir -p $(@D) - cp $< $@ - sources/plugin-installers.tgz: $(wildcard ../plugins/*) docker run --rm -w /v \ -v $(PLUGINS_DIR):/plugins \ diff --git a/deb/common/rules b/deb/common/rules index 331da261ec..ecfbc16bd9 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -38,9 +38,9 @@ override_dh_strip: override_dh_auto_install: # docker-ce-cli install - install -D -m 0644 /go/src/github.com/docker/cli/contrib/completion/fish/docker.fish debian/docker-ce-cli/usr/share/fish/vendor_completions.d/docker.fish - install -D -m 0644 /go/src/github.com/docker/cli/contrib/completion/zsh/_docker debian/docker-ce-cli/usr/share/zsh/vendor-completions/_docker - install -D -m 0755 /go/src/github.com/docker/cli/build/docker debian/docker-ce-cli/usr/bin/docker + install -D -m 0644 cli/contrib/completion/fish/docker.fish debian/docker-ce-cli/usr/share/fish/vendor_completions.d/docker.fish + install -D -m 0644 cli/contrib/completion/zsh/_docker debian/docker-ce-cli/usr/share/zsh/vendor-completions/_docker + install -D -m 0755 cli/build/docker debian/docker-ce-cli/usr/bin/docker set -e;cd /sources && \ tar xzf plugin-installers.tgz; \ for installer in plugins/*.installer; do \ @@ -49,8 +49,8 @@ override_dh_auto_install: bash $${installer} install_plugin; \ done # docker-ce install - install -D -m 0644 /sources/docker.service debian/docker-ce/lib/systemd/system/docker.service - install -D -m 0644 /sources/docker.socket debian/docker-ce/lib/systemd/system/docker.socket + install -D -m 0644 engine/contrib/init/systemd/docker.service debian/docker-ce/lib/systemd/system/docker.service + install -D -m 0644 engine/contrib/init/systemd/docker.socket debian/docker-ce/lib/systemd/system/docker.socket install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/dockerd) debian/docker-ce/usr/bin/dockerd install -D -m 0755 /usr/local/bin/docker-proxy debian/docker-ce/usr/bin/docker-proxy install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init diff --git a/rpm/Makefile b/rpm/Makefile index 1ecf7022a5..af6dbadfbd 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -84,7 +84,7 @@ centos: $(CENTOS_RELEASES) ## build all centos rpm packages rhel: $(RHEL_RELEASES) ## build all rhel rpm packages .PHONY: $(DISTROS) -$(DISTROS): rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/scan-cli-plugin.tgz rpmbuild/SOURCES/docker.service rpmbuild/SOURCES/docker.socket rpmbuild/SOURCES/plugin-installers.tgz +$(DISTROS): rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/scan-cli-plugin.tgz rpmbuild/SOURCES/plugin-installers.tgz @echo "== Building packages for $@ ==" mkdir -p "rpmbuild/$@" $(BUILD) @@ -115,14 +115,6 @@ rpmbuild/SOURCES/scan-cli-plugin.tgz: alpine \ tar -C / -c -z -f /v/scan-cli-plugin.tgz --exclude .git scan-cli-plugin -rpmbuild/SOURCES/docker.service: ../systemd/docker.service - mkdir -p $(@D) - cp $< $@ - -rpmbuild/SOURCES/docker.socket: ../systemd/docker.socket - mkdir -p $(@D) - cp $< $@ - rpmbuild/SOURCES/plugin-installers.tgz: $(wildcard ../plugins/*) docker run --rm -w /v \ -v $(PLUGINS_DIR):/plugins \ diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index f4e60b1c66..4bbd7f6f8c 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -8,8 +8,6 @@ Version: %{_version} Release: %{_release}%{?dist} Epoch: 3 Source0: engine.tgz -Source1: docker.service -Source2: docker.socket Summary: The open-source application container engine Group: Tools/Docker License: ASL 2.0 @@ -101,8 +99,8 @@ install -D -p -m 0755 /usr/local/bin/docker-proxy ${RPM_BUILD_ROOT}%{_bindir}/do install -D -p -m 755 /usr/local/bin/docker-init ${RPM_BUILD_ROOT}%{_bindir}/docker-init # install systemd scripts -install -D -m 0644 ${RPM_SOURCE_DIR}/docker.service ${RPM_BUILD_ROOT}%{_unitdir}/docker.service -install -D -m 0644 ${RPM_SOURCE_DIR}/docker.socket ${RPM_BUILD_ROOT}%{_unitdir}/docker.socket +install -D -m 0644 engine/contrib/init/systemd/docker.service ${RPM_BUILD_ROOT}%{_unitdir}/docker.service +install -D -m 0644 engine/contrib/init/systemd/docker.socket ${RPM_BUILD_ROOT}%{_unitdir}/docker.socket %files %{_bindir}/dockerd diff --git a/systemd/docker.service b/systemd/docker.service deleted file mode 100644 index 942008045d..0000000000 --- a/systemd/docker.service +++ /dev/null @@ -1,47 +0,0 @@ -[Unit] -Description=Docker Application Container Engine -Documentation=https://docs.docker.com -After=network-online.target firewalld.service containerd.service -Wants=network-online.target -Requires=docker.socket containerd.service - -[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 -TimeoutSec=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. -LimitNOFILE=infinity -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/systemd/docker.socket b/systemd/docker.socket deleted file mode 100644 index 9db5049150..0000000000 --- a/systemd/docker.socket +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Docker Socket for the API - -[Socket] -ListenStream=/var/run/docker.sock -SocketMode=0660 -SocketUser=root -SocketGroup=docker - -[Install] -WantedBy=sockets.target