Update docker.service file

This commit is contained in:
Ciprian Hacman 2020-12-15 07:04:36 +02:00
parent 6986df9523
commit 91c6df4f04
6 changed files with 13 additions and 10 deletions

View File

@ -187,7 +187,6 @@ func (b *DockerBuilder) buildSystemdService(dockerVersion semver.Version) *nodet
manifest.Set("Unit", "Description", "Docker Application Container Engine") manifest.Set("Unit", "Description", "Docker Application Container Engine")
manifest.Set("Unit", "Documentation", "https://docs.docker.com") manifest.Set("Unit", "Documentation", "https://docs.docker.com")
if dockerVersion.GTE(semver.MustParse("18.9.0")) { if dockerVersion.GTE(semver.MustParse("18.9.0")) {
manifest.Set("Unit", "BindsTo", "containerd.service")
manifest.Set("Unit", "After", "network-online.target firewalld.service containerd.service") manifest.Set("Unit", "After", "network-online.target firewalld.service containerd.service")
} else { } else {
manifest.Set("Unit", "After", "network-online.target firewalld.service") manifest.Set("Unit", "After", "network-online.target firewalld.service")
@ -198,19 +197,18 @@ func (b *DockerBuilder) buildSystemdService(dockerVersion semver.Version) *nodet
manifest.Set("Service", "EnvironmentFile", "/etc/sysconfig/docker") manifest.Set("Service", "EnvironmentFile", "/etc/sysconfig/docker")
manifest.Set("Service", "EnvironmentFile", "/etc/environment") manifest.Set("Service", "EnvironmentFile", "/etc/environment")
manifest.Set("Service", "Type", "notify")
// Restore the default SELinux security contexts for the Docker binaries // Restore the default SELinux security contexts for the Docker binaries
if b.Distribution.IsRHELFamily() && b.Cluster.Spec.Docker != nil && fi.BoolValue(b.Cluster.Spec.Docker.SelinuxEnabled) { if b.Distribution.IsRHELFamily() && b.Cluster.Spec.Docker != nil && fi.BoolValue(b.Cluster.Spec.Docker.SelinuxEnabled) {
manifest.Set("Service", "ExecStartPre", "/bin/sh -c 'restorecon -v /usr/bin/docker*'") manifest.Set("Service", "ExecStartPre", "/bin/sh -c 'restorecon -v /usr/bin/docker*'")
} }
// the default is not to use systemd for cgroups because the delegate issues still // 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 // exists and systemd currently does not support the cgroup feature set required
// for containers run by docker // for containers run by docker
manifest.Set("Service", "Type", "notify")
manifest.Set("Service", "ExecStart", "/usr/bin/dockerd -H fd:// \"$DOCKER_OPTS\"") manifest.Set("Service", "ExecStart", "/usr/bin/dockerd -H fd:// \"$DOCKER_OPTS\"")
manifest.Set("Service", "ExecReload", "/bin/kill -s HUP $MAINPID") manifest.Set("Service", "ExecReload", "/bin/kill -s HUP $MAINPID")
manifest.Set("Service", "TimeoutSec", "0") manifest.Set("Service", "TimeoutSec", "0")
manifest.Set("Service", "RestartSec", "2s") manifest.Set("Service", "RestartSec", "2")
manifest.Set("Service", "Restart", "always") manifest.Set("Service", "Restart", "always")
// Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229. // Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
@ -237,6 +235,7 @@ func (b *DockerBuilder) buildSystemdService(dockerVersion semver.Version) *nodet
// kill only the docker process, not all processes in the cgroup // kill only the docker process, not all processes in the cgroup
manifest.Set("Service", "KillMode", "process") manifest.Set("Service", "KillMode", "process")
manifest.Set("Service", "OOMScoreAdjust", "-500")
manifest.Set("Install", "WantedBy", "multi-user.target") manifest.Set("Install", "WantedBy", "multi-user.target")

View File

@ -389,7 +389,7 @@ definition: |
ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS" ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS"
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0 TimeoutSec=0
RestartSec=2s RestartSec=2
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
@ -399,6 +399,7 @@ definition: |
TasksMax=infinity TasksMax=infinity
Delegate=yes Delegate=yes
KillMode=process KillMode=process
OOMScoreAdjust=-500
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -273,7 +273,6 @@ definition: |
[Unit] [Unit]
Description=Docker Application Container Engine Description=Docker Application Container Engine
Documentation=https://docs.docker.com Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service After=network-online.target firewalld.service containerd.service
Wants=network-online.target Wants=network-online.target
Requires=docker.socket Requires=docker.socket
@ -285,7 +284,7 @@ definition: |
ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS" ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS"
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0 TimeoutSec=0
RestartSec=2s RestartSec=2
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
@ -295,6 +294,7 @@ definition: |
TasksMax=infinity TasksMax=infinity
Delegate=yes Delegate=yes
KillMode=process KillMode=process
OOMScoreAdjust=-500
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -389,7 +389,7 @@ definition: |
ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS" ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS"
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0 TimeoutSec=0
RestartSec=2s RestartSec=2
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
@ -399,6 +399,7 @@ definition: |
TasksMax=infinity TasksMax=infinity
Delegate=yes Delegate=yes
KillMode=process KillMode=process
OOMScoreAdjust=-500
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -389,7 +389,7 @@ definition: |
ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS" ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS"
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0 TimeoutSec=0
RestartSec=2s RestartSec=2
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
@ -399,6 +399,7 @@ definition: |
TasksMax=infinity TasksMax=infinity
Delegate=yes Delegate=yes
KillMode=process KillMode=process
OOMScoreAdjust=-500
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -389,7 +389,7 @@ definition: |
ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS" ExecStart=/usr/bin/dockerd -H fd:// "$DOCKER_OPTS"
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0 TimeoutSec=0
RestartSec=2s RestartSec=2
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
@ -399,6 +399,7 @@ definition: |
TasksMax=infinity TasksMax=infinity
Delegate=yes Delegate=yes
KillMode=process KillMode=process
OOMScoreAdjust=-500
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target