Add some information about the storage and execution driver choices
Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
| ... | ... |
@@ -94,20 +94,41 @@ The Docker daemon is the persistent process that manages containers. |
| 94 | 94 |
Docker uses the same binary for both the daemon and client. To run the |
| 95 | 95 |
daemon you provide the `-d` flag. |
| 96 | 96 |
|
| 97 |
-To force Docker to use devicemapper as the storage driver, use |
|
| 98 |
-`docker -d -s devicemapper`. |
|
| 99 | 97 |
|
| 100 |
-To set the DNS server for all Docker containers, use |
|
| 101 |
-`docker -d --dns 8.8.8.8`. |
|
| 98 |
+To run the daemon with debug output, use `docker -d -D`. |
|
| 102 | 99 |
|
| 103 |
-To set the DNS search domain for all Docker containers, use |
|
| 104 |
-`docker -d --dns-search example.com`. |
|
| 100 |
+### Daemon socket option |
|
| 105 | 101 |
|
| 106 |
-To run the daemon with debug output, use `docker -d -D`. |
|
| 102 |
+The Docker daemon can listen for [Docker Remote API](reference/api/docker_remote_api/) |
|
| 103 |
+requests via three different types of Socket: `unix`, `tcp`, and `fd`. |
|
| 104 |
+ |
|
| 105 |
+By default, a `unix` domain socket (or IPC socket) is created at `/var/run/docker.sock`, |
|
| 106 |
+requiring either `root` permission, or `docker` group membership. |
|
| 107 |
+ |
|
| 108 |
+If you need to access the Docker daemon remotely, you need to enable the `tcp` |
|
| 109 |
+Socket. Beware that the default setup provides un-encrypted and un-authenticated |
|
| 110 |
+direct access to the Docker daemon - and should be secured either using the |
|
| 111 |
+[built in https encrypted socket](/articles/https/), or by putting a secure web |
|
| 112 |
+proxy in front of it. You can listen on port `2375` on all network interfaces |
|
| 113 |
+with `-H tcp://0.0.0.0:2375`, or on a particular network interface using its IP |
|
| 114 |
+address: `-H tcp://192.168.59.103:2375`. |
|
| 107 | 115 |
|
| 108 |
-To use lxc as the execution driver, use `docker -d -e lxc`. |
|
| 116 |
+On Systemd based systems, you can communicate with the daemon via |
|
| 117 |
+[systemd socket activation](http://0pointer.de/blog/projects/socket-activation.html), use |
|
| 118 |
+`docker -d -H fd://`. Using `fd://` will work perfectly for most setups but |
|
| 119 |
+you can also specify individual sockets: `docker -d -H fd://3`. If the |
|
| 120 |
+specified socket activated files aren't found, then Docker will exit. You |
|
| 121 |
+can find examples of using Systemd socket activation with Docker and |
|
| 122 |
+Systemd in the [Docker source tree]( |
|
| 123 |
+https://github.com/docker/docker/tree/master/contrib/init/systemd/). |
|
| 124 |
+ |
|
| 125 |
+You can configure the Docker daemon to listen to multiple sockets at the same |
|
| 126 |
+time using multiple `-H` options: |
|
| 109 | 127 |
|
| 110 |
-The docker client will also honor the `DOCKER_HOST` environment variable to set |
|
| 128 |
+ # listen using the default unix socket, and on 2 specific IP addresses on this host. |
|
| 129 |
+ docker -d -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2 |
|
| 130 |
+ |
|
| 131 |
+The Docker client will honor the `DOCKER_HOST` environment variable to set |
|
| 111 | 132 |
the `-H` flag for the client. |
| 112 | 133 |
|
| 113 | 134 |
$ sudo docker -H tcp://0.0.0.0:2375 ps |
| ... | ... |
@@ -124,18 +145,55 @@ string is equivalent to setting the `--tlsverify` flag. The following are equiva |
| 124 | 124 |
$ export DOCKER_TLS_VERIFY=1 |
| 125 | 125 |
$ sudo docker ps |
| 126 | 126 |
|
| 127 |
+### Daemon storage-driver option |
|
| 128 |
+ |
|
| 129 |
+The Docker daemon has support for three different image layer storage drivers: `aufs`, |
|
| 130 |
+`devicemapper`, and `btrfs`. |
|
| 131 |
+ |
|
| 132 |
+The `aufs` driver is the oldest, but is based on a Linux kernel patch-set that |
|
| 133 |
+is unlikely to be merged into the main kernel. These are also known to cause some |
|
| 134 |
+serious kernel crashes. However, `aufs` is also the only storage driver that allows |
|
| 135 |
+containers to share executable and shared library memory, so is a useful choice |
|
| 136 |
+when running thousands of containers with the same program or libraries. |
|
| 137 |
+ |
|
| 138 |
+The `devicemapper` driver uses thin provisioning and Copy on Write (CoW) snapshots. |
|
| 139 |
+This driver will create a 100GB sparse file containing all your images and |
|
| 140 |
+containers. Each container will be limited to a 10 GB thin volume, and either of |
|
| 141 |
+these will require tuning - see [~jpetazzo/Resizing Docker containers with the |
|
| 142 |
+Device Mapper plugin]( http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/) |
|
| 143 |
+To tell the Docker daemon to use `devicemapper`, use |
|
| 144 |
+`docker -d -s devicemapper`. |
|
| 145 |
+ |
|
| 146 |
+The `btrfs` driver is very fast for `docker build` - but like `devicemapper` does not |
|
| 147 |
+share executable memory between devices. Use `docker -d -s btrfs -g /mnt/btrfs_partition`. |
|
| 148 |
+ |
|
| 149 |
+ |
|
| 150 |
+### Docker exec-driver option |
|
| 151 |
+ |
|
| 152 |
+The Docker daemon uses a specifically built `libcontainer` execution driver as its |
|
| 153 |
+interface to the Linux kernel `namespaces`, `cgroups`, and `SELinux`. |
|
| 154 |
+ |
|
| 155 |
+There is still legacy support for the original [LXC userspace tools]( |
|
| 156 |
+https://linuxcontainers.org/) via the `lxc` execution driver, however, this is |
|
| 157 |
+not where the primary development of new functionality is taking place. |
|
| 158 |
+Add `-e lxc` to the daemon flags to use the `lxc` execution driver. |
|
| 159 |
+ |
|
| 160 |
+ |
|
| 161 |
+### Daemon DNS options |
|
| 162 |
+ |
|
| 163 |
+To set the DNS server for all Docker containers, use |
|
| 164 |
+`docker -d --dns 8.8.8.8`. |
|
| 165 |
+ |
|
| 166 |
+To set the DNS search domain for all Docker containers, use |
|
| 167 |
+`docker -d --dns-search example.com`. |
|
| 168 |
+ |
|
| 169 |
+### Miscellaneous options |
|
| 170 |
+ |
|
| 127 | 171 |
IP masquerading uses address translation to allow containers without a public IP to talk |
| 128 | 172 |
to other machines on the Internet. This may interfere with some network topologies and |
| 129 | 173 |
can be disabled with --ip-masq=false. |
| 130 | 174 |
|
| 131 |
-To run the daemon with [systemd socket activation]( |
|
| 132 |
-http://0pointer.de/blog/projects/socket-activation.html), use |
|
| 133 |
-`docker -d -H fd://`. Using `fd://` will work perfectly for most setups but |
|
| 134 |
-you can also specify individual sockets too `docker -d -H fd://3`. If the |
|
| 135 |
-specified socket activated files aren't found then docker will exit. You |
|
| 136 |
-can find examples of using systemd socket activation with docker and |
|
| 137 |
-systemd in the [docker source tree]( |
|
| 138 |
-https://github.com/docker/docker/tree/master/contrib/init/systemd/). |
|
| 175 |
+ |
|
| 139 | 176 |
|
| 140 | 177 |
Docker supports softlinks for the Docker data directory |
| 141 | 178 |
(`/var/lib/docker`) and for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be set like this: |
| ... | ... |
@@ -145,6 +203,7 @@ Docker supports softlinks for the Docker data directory |
| 145 | 145 |
export DOCKER_TMPDIR=/mnt/disk2/tmp |
| 146 | 146 |
/usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// > /var/lib/boot2docker/docker.log 2>&1 |
| 147 | 147 |
|
| 148 |
+ |
|
| 148 | 149 |
## attach |
| 149 | 150 |
|
| 150 | 151 |
Usage: docker attach [OPTIONS] CONTAINER |