2013-10-15 09:37:18 -06:00
|
|
|
[Unit]
|
2014-01-09 12:09:25 -05:00
|
|
|
Description=Docker Application Container Engine
|
2015-06-08 10:14:35 +00:00
|
|
|
Documentation=https://docs.docker.com
|
2021-05-12 11:57:21 +02:00
|
|
|
After=network-online.target docker.socket firewalld.service containerd.service
|
2020-12-04 16:45:40 -08:00
|
|
|
Wants=network-online.target containerd.service
|
|
|
|
Requires=docker.socket
|
2013-10-15 09:37:18 -06:00
|
|
|
|
|
|
|
[Service]
|
2015-07-29 13:59:36 +01:00
|
|
|
Type=notify
|
2016-02-23 14:21:29 -08:00
|
|
|
# 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
|
2019-02-11 14:28:03 +01:00
|
|
|
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
|
2016-05-02 10:27:07 +02:00
|
|
|
ExecReload=/bin/kill -s HUP $MAINPID
|
2021-05-12 11:57:21 +02:00
|
|
|
TimeoutStartSec=0
|
2018-08-24 22:40:02 +00:00
|
|
|
RestartSec=2
|
2018-08-15 01:42:10 +00:00
|
|
|
Restart=always
|
2018-08-31 12:58:50 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2016-07-04 23:00:28 +10:00
|
|
|
# Having non-zero Limit*s causes performance problems due to accounting overhead
|
|
|
|
# in the kernel. We recommend using cgroups to do container-local accounting.
|
2018-08-31 12:45:07 +02:00
|
|
|
LimitNOFILE=infinity
|
2016-07-04 23:00:28 +10:00
|
|
|
LimitNPROC=infinity
|
2015-02-09 19:03:07 +00:00
|
|
|
LimitCORE=infinity
|
2018-08-31 12:43:32 +02:00
|
|
|
|
2019-02-27 12:49:17 +13:00
|
|
|
# Comment TasksMax if your systemd version does not support it.
|
2018-08-31 12:50:05 +02:00
|
|
|
# Only systemd 226 and above support this option.
|
|
|
|
TasksMax=infinity
|
|
|
|
|
2016-02-23 14:21:29 -08:00
|
|
|
# set delegate yes so that systemd does not reset the cgroups of docker containers
|
|
|
|
Delegate=yes
|
2018-08-31 12:53:49 +02:00
|
|
|
|
2016-06-16 11:46:04 -07:00
|
|
|
# kill only the docker process, not all processes in the cgroup
|
|
|
|
KillMode=process
|
2020-10-05 18:52:35 +02:00
|
|
|
OOMScoreAdjust=-500
|
2013-10-15 09:37:18 -06:00
|
|
|
|
|
|
|
[Install]
|
Fix system socket/service unit files
Two problems how they are today:
In the current systemd unit files it is impossible to have the
docker.service started at system boot. Instead enableing docker.service
will actually enable docker.socket. This is a problem, as that means
any container with --restart=always will not launch on reboot. And of
course as soon as you log in and type docker ps, docker.service will be
launched and now your images are running. Talk about a PITA to debug!
The fix is to just install docker.service when people ask docker.service
to be enabled. If an admin wants to enable docker.socket instead, that
is fine and will work just as it does today.
The second problem is a common docker devel workflow, although not
something normal admins would hit. In this case consider a dev doing
the following:
systemctl stop docker.service
docker -d
[run commands]
[^C]
systemctl start docker.service
Running docker -d (without -F fd://) will clean up the
/var/run/docker.sock when it exits. Remember, you just ran the docker
daemon not telling it about socket actviation, so cleaning up its socket
makes sense! The new docker, started by systemd will expect socket
activation, but the last one cleaned up the docker.sock. So things are
just broken. You can, today, work around this by restarting
docker.socket. This fixes it by telling docker.socket that it is
PartOf=docker.service. So when docker.service is
started/stopped/restarted docker.socket will also be
started/stopped/restarted. So the above semi-common devel workflow will
be fine. When docker.service is stopped, so is docker.socket, docker
-d (without -F fd://) will create and delete /var/run/docker.sock.
Starting docker.service again will restart docker.socket, which will
create the file an all is happy in the word.
Signed-off-by: Eric Paris <eparis@redhat.com>
2014-10-07 14:09:08 -04:00
|
|
|
WantedBy=multi-user.target
|