Formatting

This commit is contained in:
Misty Stanley-Jones 2016-10-25 11:27:16 -07:00 committed by GitHub
parent 107ae5850d
commit 8308f5eca6
1 changed files with 108 additions and 106 deletions

View File

@ -5,10 +5,6 @@ aliases:
description: Configuring and running the Docker daemon on various distributions
keywords:
- docker, daemon, configuration, running, process managers
menu:
main:
parent: engine_admin
weight: 0
title: Configuring and running Docker
---
@ -27,6 +23,7 @@ or `systemd` to manage the `docker` daemon's start and stop.
The Docker daemon can be run directly using the `dockerd` command. By default it listens on
the Unix socket `unix:///var/run/docker.sock`
```bash
$ dockerd
INFO[0000] +job init_networkdriver()
@ -34,6 +31,7 @@ the Unix socket `unix:///var/run/docker.sock`
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
...
...
```
### Configuring the docker daemon directly
@ -51,8 +49,9 @@ Some of the daemon's options are:
Here is an example of running the Docker daemon with configuration options:
```bash
$ dockerd -D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376
```
These options :
@ -74,8 +73,8 @@ command on Linux systems. For example, `kill -USR1 <daemon-pid>` sends the `SIGU
signal to the daemon process, causing the stack dump to be added to the daemon log.
> **Note:** The log level setting of the daemon must be at least "info" level and above for
> the stack trace to be saved to the logfile. By default the daemon's log level is set to
> "info".
the stack trace to be saved to the logfile. By default the daemon's log level is set to
"info".
The daemon will continue operating after handling the `SIGUSR1` signal and dumping the stack
traces to the log. The stack traces can be used to determine the state of all goroutines and
@ -88,21 +87,21 @@ are located in `/etc/init` and the `docker` Upstart job can be found at `/etc/i
After successfully [installing Docker for Ubuntu](../installation/linux/ubuntulinux.md),
you can check the running status using Upstart in this way:
```bash
$ sudo status docker
docker start/running, process 989
```
### Running Docker
You can start/stop/restart the `docker` daemon using
```bash
$ sudo start docker
$ sudo stop docker
$ sudo restart docker
```
### Configuring Docker
@ -122,14 +121,14 @@ you installed Docker, you may already have this file.
3. Open the file with your favorite editor.
```
```bash
$ sudo vi /etc/default/docker
```
4. Add a `DOCKER_OPTS` variable with the following options. These options are appended to the
`docker` daemon's run command.
```
```bash
DOCKER_OPTS="-D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376"
```
@ -147,13 +146,13 @@ with explanations.
6. Restart the `docker` daemon.
```
```bash
$ sudo restart docker
```
7. Verify that the `docker` daemon is running as specified with the `ps` command.
```
```bash
$ ps aux | grep docker | grep -v grep
```
@ -162,13 +161,15 @@ with explanations.
By default logs for Upstart jobs are located in `/var/log/upstart` and the logs for `docker` daemon
can be located at `/var/log/upstart/docker.log`
```bash
$ tail -f /var/log/upstart/docker.log
INFO[0000] Loading containers: done.
INFO[0000] Docker daemon commit=1b09a95-unsupported graphdriver=aufs version=1.11.0-dev
INFO[0000] +job acceptconnections()
INFO[0000] -job acceptconnections() = OK (0)
INFO[0000] Daemon has completed initialization
```
## CentOS / Red Hat Enterprise Linux / Fedora
@ -176,23 +177,23 @@ As of `7.x`, CentOS and RHEL use `systemd` as the process manager. As of `21`, F
`systemd` as its process manager.
After successfully installing Docker for [CentOS](../installation/linux/centos.md)/[Red Hat Enterprise Linux](../installation/linux/rhel.md)/[Fedora](../installation/linux/fedora.md), you can check the running status in this way:
```bash
$ sudo systemctl status docker
```
### Running Docker
You can start/stop/restart the `docker` daemon using
```bash
$ sudo systemctl start docker
$ sudo systemctl stop docker
$ sudo systemctl restart docker
```
If you want Docker to start at boot, you should also:
```bash
$ sudo systemctl enable docker
```
### Configuring Docker
For CentOS 7.x and RHEL 7.x you can [control and configure Docker with systemd](systemd.md).
@ -211,7 +212,7 @@ To configure Docker options:
2. Create the `/etc/systemd/system/docker.service.d` directory.
```
```bash
$ sudo mkdir /etc/systemd/system/docker.service.d
```
@ -219,7 +220,7 @@ To configure Docker options:
4. Open the file with your favorite editor.
```
```bash
$ sudo vi /etc/systemd/system/docker.service.d/docker.conf
```
@ -227,7 +228,7 @@ To configure Docker options:
the `docker` daemon. To modify the `ExecStart` configuration you have to specify
an empty configuration followed by a new one as follows:
```
```bash
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -D --tls=true --tlscert=/var/docker/server.pem --tlskey=/var/docker/serverkey.pem -H tcp://192.168.59.3:2376
@ -246,19 +247,19 @@ with explanations.
7. Flush changes.
```
```bash
$ sudo systemctl daemon-reload
```
8. Restart the `docker` daemon.
```
```bash
$ sudo systemctl restart docker
```
9. Verify that the `docker` daemon is running as specified with the `ps` command.
```
```bash
$ ps aux | grep docker | grep -v grep
```
@ -266,7 +267,7 @@ with explanations.
systemd has its own logging system called the journal. The logs for the `docker` daemon can
be viewed using `journalctl -u docker`
```no-highlight
$ sudo journalctl -u docker
May 06 00:22:05 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
May 06 00:22:05 localhost.localdomain docker[2495]: time="2015-05-06T00:22:05Z" level="info" msg="+job serveapi(unix:///var/run/docker.sock)"
@ -278,5 +279,6 @@ be viewed using `journalctl -u docker`
May 06 00:22:06 localhost.localdomain docker[2495]: time="2015-05-06T00:22:06Z" level="info" msg="Docker daemon commit=1b09a95-unsupported graphdriver=aufs version=1.11.0-dev"
May 06 00:22:06 localhost.localdomain docker[2495]: time="2015-05-06T00:22:06Z" level="info" msg="+job acceptconnections()"
May 06 00:22:06 localhost.localdomain docker[2495]: time="2015-05-06T00:22:06Z" level="info" msg="-job acceptconnections() = OK (0)"
```
_Note: Using and configuring journal is an advanced topic and is beyond the scope of this article._