From 9424fc14bb7465f9874e6e3560cf62b560dbd13d Mon Sep 17 00:00:00 2001 From: Ankush Agarwal Date: Tue, 21 Apr 2015 17:46:43 -0700 Subject: [PATCH 1/2] Add Configuring Docker article [WIP] Fixes #12088 Signed-off-by: Ankush Agarwal --- docs/mkdocs.yml | 1 + docs/sources/articles/configuring.md | 60 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 docs/sources/articles/configuring.md diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 49c9b80b77..59819afeeb 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -109,6 +109,7 @@ pages: - ['articles/dockerfile_best-practices.md', 'Articles', 'Best practices for writing Dockerfiles'] - ['articles/certificates.md', 'Articles', 'Using certificates for repository client verification'] - ['articles/using_supervisord.md', 'Articles', 'Using Supervisor'] +- ['articles/configuring.md', 'Articles', 'Configuring Docker'] - ['articles/cfengine_process_management.md', 'Articles', 'Process management with CFEngine'] - ['articles/puppet.md', 'Articles', 'Using Puppet'] - ['articles/chef.md', 'Articles', 'Using Chef'] diff --git a/docs/sources/articles/configuring.md b/docs/sources/articles/configuring.md new file mode 100644 index 0000000000..5fae38c5bc --- /dev/null +++ b/docs/sources/articles/configuring.md @@ -0,0 +1,60 @@ +page_title: Configuring Docker +page_description: Configuring the Docker daemon on various distributions +page_keywords: docker, daemon, configuration + +# Configuring Docker on various distributions + +After successfully installing the Docker daemon on a distribution, it runs with it's default +config. Usually it is required to change the default config to meet one's personal requirements. + +Docker can be configured by passing the config flags to the daemon directly if the daemon +is started directly. Usually that is not the case. A process manager (like SysVinit, Upstart, +systemd, etc) is responsible for starting and running the daemon. + +Some common config options are + +* `-D` : Enable debug mode + +* `-H` : Daemon socket(s) to connect to + +* `--tls` : Enable or disable TLS authentication + +The complete list of flags can found at [Docker Command Line Reference](/reference/commandline/cli/) + +## Ubuntu + +After successfully [installing Docker for Ubuntu](/installation/ubuntulinux/), you can check the +running status using (if running Upstart) + + $ sudo status docker + docker start/running, process 989 + +You can start/stop/restart `docker` using + + $ sudo start docker + + $ sudo stop docker + + $ sudo restart docker + + +### Configuring Docker + +Docker options can be configured by editing the file `/etc/default/docker`. If this file does not +exist, it needs to be createdThis file contains a variable named `DOCKER_OPTS`. All the +config options need to be placed in this variable. For example + + DOCKER_OPTS=" --dns 8.8.8.8 -D --tls=false -H tcp://0.0.0.0:2375 " + +The above daemon options : + +1. Set dns server for all containers + +2. Enable Debug mode + +3. Set tls to false + +4. Make the daemon listen for connections on `tcp://0.0.0.0:2375` + +After saving the file, restart docker using `sudo restart docker`. Verify that the daemon is +running with the options specified by running `ps aux | grep docker | grep -v grep` From 9689aab5ec0141a70c2134d18cb581ec5a923c5f Mon Sep 17 00:00:00 2001 From: Ankush Agarwal Date: Wed, 22 Apr 2015 10:35:58 -0700 Subject: [PATCH 2/2] Update with @moxiegirl's patch and add direct config Signed-off-by: Ankush Agarwal --- docs/sources/articles/configuring.md | 84 ++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/docs/sources/articles/configuring.md b/docs/sources/articles/configuring.md index 5fae38c5bc..35d0eb8e58 100644 --- a/docs/sources/articles/configuring.md +++ b/docs/sources/articles/configuring.md @@ -4,27 +4,46 @@ page_keywords: docker, daemon, configuration # Configuring Docker on various distributions -After successfully installing the Docker daemon on a distribution, it runs with it's default -config. Usually it is required to change the default config to meet one's personal requirements. - -Docker can be configured by passing the config flags to the daemon directly if the daemon -is started directly. Usually that is not the case. A process manager (like SysVinit, Upstart, -systemd, etc) is responsible for starting and running the daemon. +After successfully installing Docker, the `docker` daemon runs with it's default +configuration. You can configure the `docker` daemon by passing configuration +flags to it directly when you start it. -Some common config options are +In a production environment, system administrators typically configure the +`docker` daemon to start and stop according to an organization's requirements. In most +cases, the system administrator configures a process manager such as `SysVinit`, `Upstart`, +or `systemd` to manage the `docker` daemon's start and stop. -* `-D` : Enable debug mode +Some of the daemon's options are: -* `-H` : Daemon socket(s) to connect to +| Flag | Description | +|-----------------------|-----------------------------------------------------------| +| `-D`, `--debug=false` | Enable or disable debug mode. By default, this is false. | +| `-H`,`--host=[]` | Daemon socket(s) to connect to. | +| `--tls=false` | Enable or disable TLS. By default, this is false. | -* `--tls` : Enable or disable TLS authentication +The command line reference has the [complete list of daemon flags](/reference/commandline/cli/#daemon). + +## Direct Configuration + +If you're running the `docker` daemon directly by running `docker -d` instead of using a process manager, +you can append the config options to the run command directly. + + +Here is a an example of running the `docker` daemon with config options: + + docker -d -D --tls=false -H tcp://0.0.0.0:2375 + +These options : + +- Enable `-D` (debug) mode +- Set `tls` to false +- Listen for connections on `tcp://0.0.0.0:2375` -The complete list of flags can found at [Docker Command Line Reference](/reference/commandline/cli/) ## Ubuntu After successfully [installing Docker for Ubuntu](/installation/ubuntulinux/), you can check the -running status using (if running Upstart) +running status using Upstart in this way: $ sudo status docker docker start/running, process 989 @@ -40,21 +59,40 @@ You can start/stop/restart `docker` using ### Configuring Docker -Docker options can be configured by editing the file `/etc/default/docker`. If this file does not -exist, it needs to be createdThis file contains a variable named `DOCKER_OPTS`. All the -config options need to be placed in this variable. For example +You configure the `docker` daemon in the `/etc/default/docker` file on your +system. You do this by specifying values in a `DOCKER_OPTS` variable. +To configure Docker options: - DOCKER_OPTS=" --dns 8.8.8.8 -D --tls=false -H tcp://0.0.0.0:2375 " +1. Log into your system as a user with `sudo` or `root` privileges. -The above daemon options : +2. If you don't have one, create the `/etc/default/docker` file in your system. -1. Set dns server for all containers + Depending on how you installed Docker, you may already have this file. -2. Enable Debug mode +3. Open the file with your favorite editor. -3. Set tls to false + $ 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. -4. Make the daemon listen for connections on `tcp://0.0.0.0:2375` + ``` + DOCKER_OPTS=" --dns 8.8.8.8 --dns 8.8.4.4 -D --tls=false -H tcp://0.0.0.0:2375 " + ``` + +These options : -After saving the file, restart docker using `sudo restart docker`. Verify that the daemon is -running with the options specified by running `ps aux | grep docker | grep -v grep` +- Set `dns` server for all containers +- Enable `-D` (debug) mode +- Set `tls` to false +- Listen for connections on `tcp://0.0.0.0:2375` + +5. Save and close the file. + +6. Restart the `docker` daemon. + + $ sudo restart docker + +7. Verify that the `docker` daemon is running as specified wit the `ps` command. + + $ ps aux | grep docker | grep -v grep