Signed-off-by: Jeff Johnston <jeff.johnston.mn@gmail.com>
| ... | ... |
@@ -170,34 +170,42 @@ If you want Docker to start at boot, you should also: |
| 170 | 170 |
|
| 171 | 171 |
### Configuring Docker |
| 172 | 172 |
|
| 173 |
-You configure the `docker` daemon in the `/etc/sysconfig/docker` file on your |
|
| 174 |
-host. You do this by specifying values in a variable. For CentOS 7.x and RHEL 7.x, the name |
|
| 175 |
-of the variable is `OPTIONS` and for CentOS 6.x and RHEL 6.x, the name of the variable is |
|
| 176 |
-`other_args`. For this section, we will use CentOS 7.x as an example to configure the `docker` |
|
| 177 |
-daemon. |
|
| 173 |
+For CentOS 7.x and RHEL 7.x you can [control and configure Docker with systemd](systemd.md). |
|
| 178 | 174 |
|
| 179 |
-By default, systemd services are located either in `/etc/systemd/service`, `/lib/systemd/system` |
|
| 180 |
-or `/usr/lib/systemd/system`. The `docker.service` file can be found in either of these three |
|
| 181 |
-directories depending on your host. |
|
| 175 |
+Previously, for CentOS 6.x and RHEL 6.x you would configure the `docker` daemon in |
|
| 176 |
+the `/etc/sysconfig/docker` file on your system. You would do this by specifying |
|
| 177 |
+values in a `other_args` variable. For a short time in CentOS 7.x and RHEL 7.x you |
|
| 178 |
+would specify values in a `OPTIONS` variable. This is no longer recommended in favor |
|
| 179 |
+of using systemd directly. |
|
| 180 |
+ |
|
| 181 |
+For this section, we will use CentOS 7.x as an example to configure the `docker` daemon. |
|
| 182 | 182 |
|
| 183 | 183 |
To configure Docker options: |
| 184 | 184 |
|
| 185 | 185 |
1. Log into your host as a user with `sudo` or `root` privileges. |
| 186 | 186 |
|
| 187 |
-2. If you don't have one, create the `/etc/sysconfig/docker` file on your host. Depending on how |
|
| 188 |
-you installed Docker, you may already have this file. |
|
| 187 |
+2. Create the `/etc/systemd/system/docker.service.d` directory. |
|
| 189 | 188 |
|
| 190 |
-3. Open the file with your favorite editor. |
|
| 189 |
+ ``` |
|
| 190 |
+ $ sudo mkdir /etc/systemd/system/docker.service.d |
|
| 191 |
+ ``` |
|
| 192 |
+ |
|
| 193 |
+3. Create a `/etc/systemd/system/docker.service.d/docker.conf` file. |
|
| 194 |
+ |
|
| 195 |
+4. Open the file with your favorite editor. |
|
| 191 | 196 |
|
| 192 | 197 |
``` |
| 193 |
- $ sudo vi /etc/sysconfig/docker |
|
| 198 |
+ $ sudo vi /etc/systemd/system/docker.service.d/docker.conf |
|
| 194 | 199 |
``` |
| 195 | 200 |
|
| 196 |
-4. Add a `OPTIONS` variable with the following options. These options are appended to the |
|
| 197 |
-command that starts the `docker` daemon. |
|
| 201 |
+5. Override the `ExecStart` configuration from your `docker.service` file to customize |
|
| 202 |
+the `docker` daemon. To modify the `ExecStart` configuration you have to specify |
|
| 203 |
+an empty configuration followed by a new one as follows: |
|
| 198 | 204 |
|
| 199 | 205 |
``` |
| 200 |
- OPTIONS="-D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376" |
|
| 206 |
+[Service] |
|
| 207 |
+ExecStart= |
|
| 208 |
+ExecStart=/usr/bin/docker daemon -H fd:// -D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376 |
|
| 201 | 209 |
``` |
| 202 | 210 |
|
| 203 | 211 |
These options : |
| ... | ... |
@@ -209,15 +217,21 @@ These options : |
| 209 | 209 |
The command line reference has the [complete list of daemon flags](../reference/commandline/daemon.md) |
| 210 | 210 |
with explanations. |
| 211 | 211 |
|
| 212 |
-5. Save and close the file. |
|
| 212 |
+6. Save and close the file. |
|
| 213 | 213 |
|
| 214 |
-6. Restart the `docker` daemon. |
|
| 214 |
+7. Flush changes. |
|
| 215 |
+ |
|
| 216 |
+ ``` |
|
| 217 |
+ $ sudo systemctl daemon-reload |
|
| 218 |
+ ``` |
|
| 219 |
+ |
|
| 220 |
+8. Restart the `docker` daemon. |
|
| 215 | 221 |
|
| 216 | 222 |
``` |
| 217 | 223 |
$ sudo systemctl restart docker |
| 218 | 224 |
``` |
| 219 | 225 |
|
| 220 |
-7. Verify that the `docker` daemon is running as specified with the `ps` command. |
|
| 226 |
+9. Verify that the `docker` daemon is running as specified with the `ps` command. |
|
| 221 | 227 |
|
| 222 | 228 |
``` |
| 223 | 229 |
$ ps aux | grep docker | grep -v grep |