From afd5bf5cddab1434fb1e85d9a6c77c2914fc7e70 Mon Sep 17 00:00:00 2001 From: Isaiah Grace Date: Wed, 29 Jul 2020 17:13:04 -0400 Subject: [PATCH 1/2] systemd: add multi-user.target to After list Signed-off-by: Isaiah Grace (cherry picked from commit 36bb01538e1db523abf92232737cdc06903266b1) Signed-off-by: Sebastiaan van Stijn --- systemd/docker.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd/docker.service b/systemd/docker.service index 1be9bbabb8..a120c29574 100644 --- a/systemd/docker.service +++ b/systemd/docker.service @@ -2,7 +2,7 @@ Description=Docker Application Container Engine Documentation=https://docs.docker.com BindsTo=containerd.service -After=network-online.target firewalld.service containerd.service +After=network-online.target firewalld.service containerd.service multi-user.target Wants=network-online.target Requires=docker.socket From 317ba058ad934a655de6bd72d72f1d74f988e7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kosek?= Date: Tue, 9 Jul 2019 15:34:13 +0200 Subject: [PATCH 2/2] Do not "Bind" docker "To" containerd. relates to https://github.com/docker/for-linux/issues/678 When using the BindTo directive, Docker is permanently stopped by systemd when containerd is temporarily killed and restarted; Using `Requires` achieves mostly the same, but defines a weaker dependency; https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires= > Requires= > > .. If this unit gets activated, the units listed will be activated as well. > If one of the other units fails to activate, and an ordering dependency > After= on the failing unit is set, this unit will not be started. Besides, > with or without specifying After=, this unit will be stopped if one of the > other units is explicitly stopped. We may want to look into using `Wants=` instead of `Requires=`, because that allows docker to continue running if containerd is restarted, quoting the systemd documentation: > Often, it is a better choice to use Wants= instead of Requires= in order > to achieve a system that is more robust when dealing with failing services. Given that docker will likely still fail if the containerd socket is not present, startup will fail if containerd is not running, but if containerd is restarted, the docker daemon may be able to try reconnecting. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 22f15d4137cb5d090f13fc5d9093dc3085dce67b) Signed-off-by: Sebastiaan van Stijn --- systemd/docker.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/systemd/docker.service b/systemd/docker.service index a120c29574..a78fa113a6 100644 --- a/systemd/docker.service +++ b/systemd/docker.service @@ -1,10 +1,9 @@ [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com -BindsTo=containerd.service After=network-online.target firewalld.service containerd.service multi-user.target Wants=network-online.target -Requires=docker.socket +Requires=docker.socket containerd.service [Service] Type=notify