Signed-off-by: Luciano Mores <leslau@gmail.com>
| ... | ... |
@@ -53,7 +53,7 @@ following: |
| 53 | 53 |
EnvironmentFile=-/etc/sysconfig/docker-storage |
| 54 | 54 |
EnvironmentFile=-/etc/sysconfig/docker-network |
| 55 | 55 |
ExecStart= |
| 56 |
- ExecStart=/usr/bin/dockerd -H fd:// $OPTIONS \ |
|
| 56 |
+ ExecStart=/usr/bin/dockerd $OPTIONS \ |
|
| 57 | 57 |
$DOCKER_STORAGE_OPTIONS \ |
| 58 | 58 |
$DOCKER_NETWORK_OPTIONS \ |
| 59 | 59 |
$BLOCK_REGISTRY \ |
| ... | ... |
@@ -85,18 +85,31 @@ In this example, we'll assume that your `docker.service` file looks something li |
| 85 | 85 |
[Unit] |
| 86 | 86 |
Description=Docker Application Container Engine |
| 87 | 87 |
Documentation=https://docs.docker.com |
| 88 |
- After=network.target docker.socket |
|
| 89 |
- Requires=docker.socket |
|
| 88 |
+ After=network.target |
|
| 90 | 89 |
|
| 91 | 90 |
[Service] |
| 92 | 91 |
Type=notify |
| 93 |
- ExecStart=/usr/bin/dockerd -H fd:// |
|
| 94 |
- LimitNOFILE=1048576 |
|
| 95 |
- LimitNPROC=1048576 |
|
| 96 |
- TasksMax=1048576 |
|
| 92 |
+ # the default is not to use systemd for cgroups because the delegate issues still |
|
| 93 |
+ # exists and systemd currently does not support the cgroup feature set required |
|
| 94 |
+ # for containers run by docker |
|
| 95 |
+ ExecStart=/usr/bin/dockerd |
|
| 96 |
+ ExecReload=/bin/kill -s HUP $MAINPID |
|
| 97 |
+ # Having non-zero Limit*s causes performance problems due to accounting overhead |
|
| 98 |
+ # in the kernel. We recommend using cgroups to do container-local accounting. |
|
| 99 |
+ LimitNOFILE=infinity |
|
| 100 |
+ LimitNPROC=infinity |
|
| 101 |
+ LimitCORE=infinity |
|
| 102 |
+ # Uncomment TasksMax if your systemd version supports it. |
|
| 103 |
+ # Only systemd 226 and above support this version. |
|
| 104 |
+ #TasksMax=infinity |
|
| 105 |
+ TimeoutStartSec=0 |
|
| 106 |
+ # set delegate yes so that systemd does not reset the cgroups of docker containers |
|
| 107 |
+ Delegate=yes |
|
| 108 |
+ # kill only the docker process, not all processes in the cgroup |
|
| 109 |
+ KillMode=process |
|
| 97 | 110 |
|
| 98 | 111 |
[Install] |
| 99 |
- Also=docker.socket |
|
| 112 |
+ WantedBy=multi-user.target |
|
| 100 | 113 |
|
| 101 | 114 |
This will allow us to add extra flags via a drop-in file (mentioned above) by |
| 102 | 115 |
placing a file containing the following in the `/etc/systemd/system/docker.service.d` |
| ... | ... |
@@ -104,7 +117,7 @@ directory: |
| 104 | 104 |
|
| 105 | 105 |
[Service] |
| 106 | 106 |
ExecStart= |
| 107 |
- ExecStart=/usr/bin/dockerd -H fd:// --graph="/mnt/docker-data" --storage-driver=overlay |
|
| 107 |
+ ExecStart=/usr/bin/dockerd --graph="/mnt/docker-data" --storage-driver=overlay |
|
| 108 | 108 |
|
| 109 | 109 |
You can also set other environment variables in this file, for example, the |
| 110 | 110 |
`HTTP_PROXY` environment variables described below. |
| ... | ... |
@@ -114,7 +127,7 @@ by a new configuration as follows: |
| 114 | 114 |
|
| 115 | 115 |
[Service] |
| 116 | 116 |
ExecStart= |
| 117 |
- ExecStart=/usr/bin/dockerd -H fd:// --bip=172.17.42.1/16 |
|
| 117 |
+ ExecStart=/usr/bin/dockerd --bip=172.17.42.1/16 |
|
| 118 | 118 |
|
| 119 | 119 |
If you fail to specify an empty configuration, Docker reports an error such as: |
| 120 | 120 |
|