Docker-DCO-1.1-Signed-off-by: James Turnbull <james@lovedthanlost.net> (github: jamtur01)
| ... | ... |
@@ -49,13 +49,11 @@ For each container, one cgroup will be created in each hierarchy. On |
| 49 | 49 |
older systems with older versions of the LXC userland tools, the name of |
| 50 | 50 |
the cgroup will be the name of the container. With more recent versions |
| 51 | 51 |
of the LXC tools, the cgroup will be `lxc/<container_name>.` |
| 52 |
-.literal} |
|
| 53 | 52 |
|
| 54 | 53 |
For Docker containers using cgroups, the container name will be the full |
| 55 | 54 |
ID or long ID of the container. If a container shows up as ae836c95b4c3 |
| 56 | 55 |
in `docker ps`, its long ID might be something like |
| 57 |
-`ae836c95b4c3c9e9179e0e91015512da89fdec91612f63cebae57df9a5444c79` |
|
| 58 |
-.literal}. You can look it up with `docker inspect` |
|
| 56 |
+`ae836c95b4c3c9e9179e0e91015512da89fdec91612f63cebae57df9a5444c79`. You can look it up with `docker inspect` |
|
| 59 | 57 |
or `docker ps -notrunc`. |
| 60 | 58 |
|
| 61 | 59 |
Putting everything together to look at the memory metrics for a Docker |
| ... | ... |
@@ -206,14 +204,13 @@ Now that we’ve covered memory metrics, everything else will look very |
| 206 | 206 |
simple in comparison. CPU metrics will be found in the |
| 207 | 207 |
`cpuacct` controller. |
| 208 | 208 |
|
| 209 |
-For each container, you will find a pseudo-file `cpuacct.stat` |
|
| 210 |
-.literal}, containing the CPU usage accumulated by the processes of the |
|
| 211 |
-container, broken down between `user` and |
|
| 212 |
-`system` time. If you’re not familiar with the |
|
| 213 |
-distinction, `user` is the time during which the |
|
| 214 |
-processes were in direct control of the CPU (i.e. executing process |
|
| 215 |
-code), and `system` is the time during which the CPU |
|
| 216 |
-was executing system calls on behalf of those processes. |
|
| 209 |
+For each container, you will find a pseudo-file `cpuacct.stat`, |
|
| 210 |
+containing the CPU usage accumulated by the processes of the container, |
|
| 211 |
+broken down between `user` and `system` time. If you’re not familiar |
|
| 212 |
+with the distinction, `user` is the time during which the processes were |
|
| 213 |
+in direct control of the CPU (i.e. executing process code), and `system` |
|
| 214 |
+is the time during which the CPU was executing system calls on behalf of |
|
| 215 |
+those processes. |
|
| 217 | 216 |
|
| 218 | 217 |
Those times are expressed in ticks of 1/100th of a second. Actually, |
| 219 | 218 |
they are expressed in "user jiffies". There are `USER_HZ` |
| ... | ... |
@@ -407,11 +404,10 @@ Sometimes, you do not care about real time metric collection, but when a |
| 407 | 407 |
container exits, you want to know how much CPU, memory, etc. it has |
| 408 | 408 |
used. |
| 409 | 409 |
|
| 410 |
-Docker makes this difficult because it relies on `lxc-start` |
|
| 411 |
-.literal}, which carefully cleans up after itself, but it is still |
|
| 412 |
-possible. It is usually easier to collect metrics at regular intervals |
|
| 413 |
-(e.g. every minute, with the collectd LXC plugin) and rely on that |
|
| 414 |
-instead. |
|
| 410 |
+Docker makes this difficult because it relies on `lxc-start`, which |
|
| 411 |
+carefully cleans up after itself, but it is still possible. It is |
|
| 412 |
+usually easier to collect metrics at regular intervals (e.g. every |
|
| 413 |
+minute, with the collectd LXC plugin) and rely on that instead. |
|
| 415 | 414 |
|
| 416 | 415 |
But, if you’d still like to gather the stats when a container stops, |
| 417 | 416 |
here is how: |
| ... | ... |
@@ -71,8 +71,7 @@ a local version of a common base: |
| 71 | 71 |
# docker build -t my_ubuntu . |
| 72 | 72 |
|
| 73 | 73 |
**Option 2** is good for testing, but will break other HTTP clients |
| 74 |
-which obey `http_proxy`, such as `curl` |
|
| 75 |
-.literal}, `wget` and others: |
|
| 74 |
+which obey `http_proxy`, such as `curl`, `wget` and others: |
|
| 76 | 75 |
|
| 77 | 76 |
$ sudo docker run --rm -t -i -e http_proxy=http://dockerhost:3142/ debian bash |
| 78 | 77 |
|
| ... | ... |
@@ -25,9 +25,8 @@ volume. |
| 25 | 25 |
|
| 26 | 26 |
## Add data to the first database |
| 27 | 27 |
|
| 28 |
-We’re assuming your Docker host is reachable at `localhost` |
|
| 29 |
-.literal}. If not, replace `localhost` with the |
|
| 30 |
-public IP of your Docker host. |
|
| 28 |
+We’re assuming your Docker host is reachable at `localhost`. If not, |
|
| 29 |
+replace `localhost` with the public IP of your Docker host. |
|
| 31 | 30 |
|
| 32 | 31 |
HOST=localhost |
| 33 | 32 |
URL="http://$HOST:$(sudo docker port $COUCH1 5984 | grep -Po '\d+$')/_utils/" |
| ... | ... |
@@ -35,8 +34,7 @@ public IP of your Docker host. |
| 35 | 35 |
|
| 36 | 36 |
## Create second database |
| 37 | 37 |
|
| 38 |
-This time, we’re requesting shared access to `$COUCH1` |
|
| 39 |
-.literal}‘s volumes. |
|
| 38 |
+This time, we’re requesting shared access to `$COUCH1`'s volumes. |
|
| 40 | 39 |
|
| 41 | 40 |
COUCH2=$(sudo docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03) |
| 42 | 41 |
|
| ... | ... |
@@ -64,10 +64,8 @@ commands, try things out, and then exit when you’re done. |
| 64 | 64 |
Save the changes we just made in the container to a new image called |
| 65 | 65 |
`/builds/github.com/shykes/helloflask/master`. You |
| 66 | 66 |
now have 3 different ways to refer to the container: name |
| 67 |
-`pybuilder_run`, short-id `c8b2e8228f11` |
|
| 68 |
-.literal}, or long-id |
|
| 69 |
-`c8b2e8228f11b8b3e492cbf9a49923ae66496230056d61e07880dc74c5f495f9` |
|
| 70 |
-.literal}. |
|
| 67 |
+`pybuilder_run`, short-id `c8b2e8228f11`, or long-id |
|
| 68 |
+`c8b2e8228f11b8b3e492cbf9a49923ae66496230056d61e07880dc74c5f495f9`. |
|
| 71 | 69 |
|
| 72 | 70 |
$ sudo docker commit pybuilder_run /builds/github.com/shykes/helloflask/master |
| 73 | 71 |
c8b2e8228f11b8b3e492cbf9a49923ae66496230056d61e07880dc74c5f495f9 |
| ... | ... |
@@ -101,8 +101,7 @@ are started: |
| 101 | 101 |
## Create a `supervisord` configuration file |
| 102 | 102 |
|
| 103 | 103 |
Create an empty file called `supervisord.conf`. Make |
| 104 |
-sure it’s at the same directory level as your `Dockerfile` |
|
| 105 |
-.literal}: |
|
| 104 |
+sure it’s at the same directory level as your `Dockerfile`: |
|
| 106 | 105 |
|
| 107 | 106 |
touch supervisord.conf |
| 108 | 107 |
|
| ... | ... |
@@ -86,7 +86,7 @@ page_keywords: faq, questions, documentation, docker |
| 86 | 86 |
> full traceability from the production server all the way back |
| 87 | 87 |
> to the upstream developer. Docker also implements incremental |
| 88 | 88 |
> uploads and downloads, similar to `git pull` |
| 89 |
-> .literal}, so new versions of a container can be transferred |
|
| 89 |
+> , so new versions of a container can be transferred |
|
| 90 | 90 |
> by only sending diffs. |
| 91 | 91 |
> |
| 92 | 92 |
> - *Component re-use.* |
| ... | ... |
@@ -77,7 +77,6 @@ Repository. |
| 77 | 77 |
left side |
| 78 | 78 |
- Search for ‘2014.03’ and select one of the Amazon provided AMI, |
| 79 | 79 |
for example `amzn-ami-pv-2014.03.rc-0.x86_64-ebs` |
| 80 |
- .literal} |
|
| 81 | 80 |
- For testing you can use the default (possibly free) |
| 82 | 81 |
`t1.micro` instance (more info on |
| 83 | 82 |
[pricing](http://aws.amazon.com/en/ec2/pricing/)). |
| ... | ... |
@@ -26,12 +26,11 @@ bit** architecture. |
| 26 | 26 |
|
| 27 | 27 |
The `docker-io` package provides Docker on Fedora. |
| 28 | 28 |
|
| 29 |
-If you have the (unrelated) `docker` package |
|
| 30 |
-installed already, it will conflict with `docker-io` |
|
| 31 |
-.literal}. There’s a [bug |
|
| 29 |
+If you have the (unrelated) `docker` package installed already, it will |
|
| 30 |
+conflict with `docker-io`. There’s a [bug |
|
| 32 | 31 |
report](https://bugzilla.redhat.com/show_bug.cgi?id=1043676) filed for |
| 33 |
-it. To proceed with `docker-io` installation on |
|
| 34 |
-Fedora 19, please remove `docker` first. |
|
| 32 |
+it. To proceed with `docker-io` installation on Fedora 19, please remove |
|
| 33 |
+`docker` first. |
|
| 35 | 34 |
|
| 36 | 35 |
sudo yum -y remove docker |
| 37 | 36 |
|
| ... | ... |
@@ -35,8 +35,8 @@ you will need to set the kernel manually. |
| 35 | 35 |
# install the new kernel |
| 36 | 36 |
apt-get install linux-generic-lts-raring |
| 37 | 37 |
|
| 38 |
-Great, now you have the kernel installed in `/boot/` |
|
| 39 |
-.literal}, next you need to make it boot next time. |
|
| 38 |
+Great, now you have the kernel installed in `/boot/`, next you need to |
|
| 39 |
+make it boot next time. |
|
| 40 | 40 |
|
| 41 | 41 |
# find the exact names |
| 42 | 42 |
find /boot/ -name '*3.8*' |
| ... | ... |
@@ -172,8 +172,8 @@ than `docker` should own the Unix socket with the |
| 172 | 172 |
|
| 173 | 173 |
Warning |
| 174 | 174 |
|
| 175 |
-The *docker* group (or the group specified with `-G` |
|
| 176 |
-.literal}) is root-equivalent; see [*Docker Daemon Attack |
|
| 175 |
+The *docker* group (or the group specified with `-G`) is |
|
| 176 |
+root-equivalent; see [*Docker Daemon Attack |
|
| 177 | 177 |
Surface*](../../articles/security/#dockersecurity-daemon) details. |
| 178 | 178 |
|
| 179 | 179 |
**Example:** |
| ... | ... |
@@ -72,10 +72,8 @@ following a link in your application to an OAuth Authorization endpoint. |
| 72 | 72 |
included, it must be one of the URIs which were submitted when |
| 73 | 73 |
registering your application. |
| 74 | 74 |
- **scope** – The extent of access permissions you are requesting. |
| 75 |
- Currently, the scope options are `profile_read` |
|
| 76 |
- .literal}, `profile_write`, |
|
| 77 |
- `email_read`, and `email_write` |
|
| 78 |
- .literal}. Scopes must be separated by a space. If omitted, the |
|
| 75 |
+ Currently, the scope options are `profile_read`, `profile_write`, |
|
| 76 |
+ `email_read`, and `email_write`. Scopes must be separated by a space. If omitted, the |
|
| 79 | 77 |
default scopes `profile_read email_read` are |
| 80 | 78 |
used. |
| 81 | 79 |
- **state** – (Recommended) Used by your application to maintain |
| ... | ... |
@@ -140,7 +138,6 @@ to get an Access Token. |
| 140 | 140 |
|
| 141 | 141 |
|
| 142 | 142 |
- **grant\_type** – MUST be set to `authorization_code` |
| 143 |
- .literal} |
|
| 144 | 143 |
- **code** – The authorization code received from the user’s |
| 145 | 144 |
redirect request. |
| 146 | 145 |
- **redirect\_uri** – The same `redirect_uri` |
| ... | ... |
@@ -204,7 +201,6 @@ if the user has not revoked access from your application. |
| 204 | 204 |
|
| 205 | 205 |
|
| 206 | 206 |
- **grant\_type** – MUST be set to `refresh_token` |
| 207 |
- .literal} |
|
| 208 | 207 |
- **refresh\_token** – The `refresh_token` |
| 209 | 208 |
which was issued to your application. |
| 210 | 209 |
- **scope** – (optional) The scope of the access token to be |
| ... | ... |
@@ -254,9 +254,9 @@ All new files and directories are created with mode 0755, uid and gid 0. |
| 254 | 254 |
|
| 255 | 255 |
Note |
| 256 | 256 |
|
| 257 |
-if you build using STDIN (`docker build - < somefile` |
|
| 258 |
-.literal}), there is no build context, so the Dockerfile can only |
|
| 259 |
-contain an URL based ADD statement. |
|
| 257 |
+if you build using STDIN (`docker build - < somefile`), there is no |
|
| 258 |
+build context, so the Dockerfile can only contain an URL based ADD |
|
| 259 |
+statement. |
|
| 260 | 260 |
|
| 261 | 261 |
Note |
| 262 | 262 |
|
| ... | ... |
@@ -335,12 +335,11 @@ that you can run as an executable. That is, when you specify an |
| 335 | 335 |
`ENTRYPOINT`, then the whole container runs as if it |
| 336 | 336 |
was just that executable. |
| 337 | 337 |
|
| 338 |
-The `ENTRYPOINT` instruction adds an entry command |
|
| 339 |
-that will **not** be overwritten when arguments are passed to |
|
| 340 |
-`docker run`, unlike the behavior of `CMD` |
|
| 341 |
-.literal}. This allows arguments to be passed to the entrypoint. i.e. |
|
| 342 |
-`docker run <image> -d` will pass the "-d" argument |
|
| 343 |
-to the ENTRYPOINT. |
|
| 338 |
+The `ENTRYPOINT` instruction adds an entry command that will **not** be |
|
| 339 |
+overwritten when arguments are passed to `docker run`, unlike the |
|
| 340 |
+behavior of `CMD`. This allows arguments to be passed to the entrypoint. |
|
| 341 |
+i.e. `docker run <image> -d` will pass the "-d" argument to the |
|
| 342 |
+ENTRYPOINT. |
|
| 344 | 343 |
|
| 345 | 344 |
You can specify parameters either in the ENTRYPOINT JSON array (as in |
| 346 | 345 |
"like an exec" above), or by using a CMD statement. Parameters in the |
| ... | ... |
@@ -19,8 +19,7 @@ no parameters or execute `docker help`: |
| 19 | 19 |
|
| 20 | 20 |
Single character commandline options can be combined, so rather than |
| 21 | 21 |
typing `docker run -t -i --name test busybox sh`, |
| 22 |
-you can write `docker run -ti --name test busybox sh` |
|
| 23 |
-.literal}. |
|
| 22 |
+you can write `docker run -ti --name test busybox sh`. |
|
| 24 | 23 |
|
| 25 | 24 |
### Boolean |
| 26 | 25 |
|
| ... | ... |
@@ -92,11 +91,9 @@ To set the DNS server for all Docker containers, use |
| 92 | 92 |
To set the DNS search domain for all Docker containers, use |
| 93 | 93 |
`docker -d --dns-search example.com`. |
| 94 | 94 |
|
| 95 |
-To run the daemon with debug output, use `docker -d -D` |
|
| 96 |
-.literal}. |
|
| 95 |
+To run the daemon with debug output, use `docker -d -D`. |
|
| 97 | 96 |
|
| 98 |
-To use lxc as the execution driver, use `docker -d -e lxc` |
|
| 99 |
-.literal}. |
|
| 97 |
+To use lxc as the execution driver, use `docker -d -e lxc`. |
|
| 100 | 98 |
|
| 101 | 99 |
The docker client will also honor the `DOCKER_HOST` |
| 102 | 100 |
environment variable to set the `-H` flag for the |
| ... | ... |
@@ -119,8 +116,7 @@ systemd in the [docker source |
| 119 | 119 |
tree](https://github.com/dotcloud/docker/blob/master/contrib/init/systemd/socket-activation/). |
| 120 | 120 |
|
| 121 | 121 |
Docker supports softlinks for the Docker data directory |
| 122 |
-(`/var/lib/docker`) and for `/tmp` |
|
| 123 |
-.literal}. TMPDIR and the data directory can be set like this: |
|
| 122 |
+(`/var/lib/docker`) and for `/tmp`. TMPDIR and the data directory can be set like this: |
|
| 124 | 123 |
|
| 125 | 124 |
TMPDIR=/mnt/disk2/tmp /usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// > /var/lib/boot2docker/docker.log 2>&1 |
| 126 | 125 |
# or |
| ... | ... |
@@ -254,8 +250,7 @@ machine and that no parsing of the `Dockerfile` |
| 254 | 254 |
happens at the client side (where you’re running |
| 255 | 255 |
`docker build`). That means that *all* the files at |
| 256 | 256 |
`PATH` get sent, not just the ones listed to |
| 257 |
-[*ADD*](../../builder/#dockerfile-add) in the `Dockerfile` |
|
| 258 |
-.literal}. |
|
| 257 |
+[*ADD*](../../builder/#dockerfile-add) in the `Dockerfile`. |
|
| 259 | 258 |
|
| 260 | 259 |
The transfer of context from the local machine to the Docker daemon is |
| 261 | 260 |
what the `docker` client means when you see the |
| ... | ... |
@@ -658,9 +653,8 @@ Restores both images and tags. |
| 658 | 658 |
The `docker logs` command batch-retrieves all logs |
| 659 | 659 |
present at the time of execution. |
| 660 | 660 |
|
| 661 |
-The `docker logs --follow` command combines |
|
| 662 |
-`docker logs` and `docker attach` |
|
| 663 |
-.literal}: it will first return all logs from the beginning and then |
|
| 661 |
+The `docker logs --follow` command combines `docker logs` and `docker |
|
| 662 |
+attach`: it will first return all logs from the beginning and then |
|
| 664 | 663 |
continue streaming new output from the container’s stdout and stderr. |
| 665 | 664 |
|
| 666 | 665 |
## `port` |
| ... | ... |
@@ -957,10 +951,8 @@ container). All three flags, `-e`, `--env` |
| 957 | 957 |
and `--env-file` can be repeated. |
| 958 | 958 |
|
| 959 | 959 |
Regardless of the order of these three flags, the `--env-file` |
| 960 |
-are processed first, and then `-e` |
|
| 961 |
-.literal}/`--env` flags. This way, the |
|
| 962 |
-`-e` or `--env` will override |
|
| 963 |
-variables as needed. |
|
| 960 |
+are processed first, and then `-e`, `--env` flags. This way, the |
|
| 961 |
+`-e` or `--env` will override variables as needed. |
|
| 964 | 962 |
|
| 965 | 963 |
$ cat ./env.list |
| 966 | 964 |
TEST_FOO=BAR |
| ... | ... |
@@ -46,8 +46,8 @@ and nearly all the defaults set by the Docker runtime itself. |
| 46 | 46 |
|
| 47 | 47 |
## [Operator Exclusive Options](#id4) |
| 48 | 48 |
|
| 49 |
-Only the operator (the person executing `docker run` |
|
| 50 |
-.literal}) can set the following options. |
|
| 49 |
+Only the operator (the person executing `docker run`) can set the |
|
| 50 |
+following options. |
|
| 51 | 51 |
|
| 52 | 52 |
- [Detached vs Foreground](#detached-vs-foreground) |
| 53 | 53 |
- [Detached (-d)](#detached-d) |
| ... | ... |
@@ -72,14 +72,12 @@ default foreground mode: |
| 72 | 72 |
|
| 73 | 73 |
#### [Detached (-d)](#id3) |
| 74 | 74 |
|
| 75 |
-In detached mode (`-d=true` or just `-d` |
|
| 76 |
-.literal}), all I/O should be done through network connections or shared |
|
| 77 |
-volumes because the container is no longer listening to the commandline |
|
| 78 |
-where you executed `docker run`. You can reattach to |
|
| 79 |
-a detached container with `docker` |
|
| 75 |
+In detached mode (`-d=true` or just `-d`), all I/O should be done |
|
| 76 |
+through network connections or shared volumes because the container is |
|
| 77 |
+no longer listening to the commandline where you executed `docker run`. |
|
| 78 |
+You can reattach to a detached container with `docker` |
|
| 80 | 79 |
[*attach*](../commandline/cli/#cli-attach). If you choose to run a |
| 81 |
-container in the detached mode, then you cannot use the `--rm` |
|
| 82 |
-option. |
|
| 80 |
+container in the detached mode, then you cannot use the `--rm` option. |
|
| 83 | 81 |
|
| 84 | 82 |
#### [Foreground](#id4) |
| 85 | 83 |
|
| ... | ... |
@@ -196,12 +194,12 @@ by default a container is not allowed to access any devices, but a |
| 196 | 196 |
and documentation on [cgroups |
| 197 | 197 |
devices](https://www.kernel.org/doc/Documentation/cgroups/devices.txt)). |
| 198 | 198 |
|
| 199 |
-When the operator executes `docker run --privileged` |
|
| 200 |
-.literal}, Docker will enable to access to all devices on the host as |
|
| 201 |
-well as set some configuration in AppArmor to allow the container nearly |
|
| 202 |
-all the same access to the host as processes running outside containers |
|
| 203 |
-on the host. Additional information about running with |
|
| 204 |
-`--privileged` is available on the [Docker |
|
| 199 |
+When the operator executes `docker run --privileged`, Docker will enable |
|
| 200 |
+to access to all devices on the host as well as set some configuration |
|
| 201 |
+in AppArmor to allow the container nearly all the same access to the |
|
| 202 |
+host as processes running outside containers on the host. Additional |
|
| 203 |
+information about running with `--privileged` is available on the |
|
| 204 |
+[Docker |
|
| 205 | 205 |
Blog](http://blog.docker.io/2013/09/docker-can-now-run-within-docker/). |
| 206 | 206 |
|
| 207 | 207 |
If the Docker daemon was started using the `lxc` |
| ... | ... |
@@ -259,19 +257,17 @@ as arguments to the `ENTRYPOINT`. |
| 259 | 259 |
|
| 260 | 260 |
--entrypoint="": Overwrite the default entrypoint set by the image |
| 261 | 261 |
|
| 262 |
-The ENTRYPOINT of an image is similar to a `COMMAND` |
|
| 263 |
-because it specifies what executable to run when the container starts, |
|
| 264 |
-but it is (purposely) more difficult to override. The |
|
| 265 |
-`ENTRYPOINT` gives a container its default nature or |
|
| 266 |
-behavior, so that when you set an `ENTRYPOINT` you |
|
| 267 |
-can run the container *as if it were that binary*, complete with default |
|
| 268 |
-options, and you can pass in more options via the `COMMAND` |
|
| 269 |
-.literal}. But, sometimes an operator may want to run something else |
|
| 270 |
-inside the container, so you can override the default |
|
| 271 |
-`ENTRYPOINT` at runtime by using a string to specify |
|
| 272 |
-the new `ENTRYPOINT`. Here is an example of how to |
|
| 273 |
-run a shell in a container that has been set up to automatically run |
|
| 274 |
-something else (like `/usr/bin/redis-server`): |
|
| 262 |
+The ENTRYPOINT of an image is similar to a `COMMAND` because it |
|
| 263 |
+specifies what executable to run when the container starts, but it is |
|
| 264 |
+(purposely) more difficult to override. The `ENTRYPOINT` gives a |
|
| 265 |
+container its default nature or behavior, so that when you set an |
|
| 266 |
+`ENTRYPOINT` you can run the container *as if it were that binary*, |
|
| 267 |
+complete with default options, and you can pass in more options via the |
|
| 268 |
+`COMMAND`. But, sometimes an operator may want to run something else |
|
| 269 |
+inside the container, so you can override the default `ENTRYPOINT` at |
|
| 270 |
+runtime by using a string to specify the new `ENTRYPOINT`. Here is an |
|
| 271 |
+example of how to run a shell in a container that has been set up to |
|
| 272 |
+automatically run something else (like `/usr/bin/redis-server`): |
|
| 275 | 273 |
|
| 276 | 274 |
docker run -i -t --entrypoint /bin/bash example/redis |
| 277 | 275 |
|
| ... | ... |
@@ -330,8 +326,7 @@ port to use. |
| 330 | 330 |
|
| 331 | 331 |
The operator can **set any environment variable** in the container by |
| 332 | 332 |
using one or more `-e` flags, even overriding those |
| 333 |
-already defined by the developer with a Dockefile `ENV` |
|
| 334 |
-.literal}: |
|
| 333 |
+already defined by the developer with a Dockefile `ENV`: |
|
| 335 | 334 |
|
| 336 | 335 |
$ docker run -e "deep=purple" --rm ubuntu /bin/bash -c export |
| 337 | 336 |
declare -x HOME="/" |
| ... | ... |
@@ -343,8 +338,7 @@ already defined by the developer with a Dockefile `ENV` |
| 343 | 343 |
declare -x container="lxc" |
| 344 | 344 |
declare -x deep="purple" |
| 345 | 345 |
|
| 346 |
-Similarly the operator can set the **hostname** with `-h` |
|
| 347 |
-.literal}. |
|
| 346 |
+Similarly the operator can set the **hostname** with `-h`. |
|
| 348 | 347 |
|
| 349 | 348 |
`--link name:alias` also sets environment variables, |
| 350 | 349 |
using the *alias* string to define environment variables within the |
| ... | ... |
@@ -23,7 +23,6 @@ an image name using one of three different commands: |
| 23 | 23 |
A Fully Qualified Image Name (FQIN) can be made up of 3 parts: |
| 24 | 24 |
|
| 25 | 25 |
`[registry_hostname[:port]/][user_name/](repository_name:version_tag)` |
| 26 |
-.literal} |
|
| 27 | 26 |
|
| 28 | 27 |
`username` and `registry_hostname` |
| 29 | 28 |
default to an empty string. When `registry_hostname` |
| ... | ... |
@@ -135,8 +135,7 @@ the `-e` command line option. |
| 135 | 135 |
|
| 136 | 136 |
`--expose 1234 -e REDIS_PORT_1234_TCP=tcp://192.168.1.52:6379` |
| 137 | 137 |
will forward the local `1234` port to the |
| 138 |
-remote IP and port - in this case `192.168.1.52:6379` |
|
| 139 |
-.literal}. |
|
| 138 |
+remote IP and port - in this case `192.168.1.52:6379`. |
|
| 140 | 139 |
|
| 141 | 140 |
# |
| 142 | 141 |
# |
| ... | ... |
@@ -154,4 +153,4 @@ remote IP and port - in this case `192.168.1.52:6379` |
| 154 | 154 |
MAINTAINER SvenDowideit@home.org.au |
| 155 | 155 |
|
| 156 | 156 |
|
| 157 |
- CMD env | grep _TCP= | sed 's/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&/' | sh && top |
|
| 158 | 157 |
\ No newline at end of file |
| 158 |
+ CMD env | grep _TCP= | sed 's/.*_PORT_\([0-9]*\)_TCP=tcp:\/\/\(.*\):\(.*\)/socat TCP4-LISTEN:\1,fork,reuseaddr TCP4:\2:\3 \&/' | sh && top |
| ... | ... |
@@ -39,8 +39,7 @@ characters of the full image ID - which can be found using |
| 39 | 39 |
`docker inspect` or |
| 40 | 40 |
`docker images --no-trunc=true` |
| 41 | 41 |
|
| 42 |
-**If you’re using OS X** then you shouldn’t use `sudo` |
|
| 43 |
-.literal} |
|
| 42 |
+**If you’re using OS X** then you shouldn’t use `sudo`. |
|
| 44 | 43 |
|
| 45 | 44 |
## Running an interactive shell |
| 46 | 45 |
|
| ... | ... |
@@ -27,12 +27,11 @@ managed by Docker for this purpose. When the Docker daemon starts it : |
| 27 | 27 |
docker0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx |
| 28 | 28 |
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0 |
| 29 | 29 |
|
| 30 |
-At runtime, a [*specific kind of virtual interface*](#what-is-the-vethxxxx-device) |
|
| 31 |
-is given to each container which is then bonded to the |
|
| 32 |
-`docker0` bridge. Each container also receives a |
|
| 33 |
-dedicated IP address from the same range as `docker0` |
|
| 34 |
-.literal}. The `docker0` IP address is used as the |
|
| 35 |
-default gateway for the container. |
|
| 30 |
+At runtime, a [*specific kind of virtual interface*](#vethxxxx-device) |
|
| 31 |
+is given to each container which is then bonded to the `docker0` bridge. |
|
| 32 |
+Each container also receives a dedicated IP address from the same range |
|
| 33 |
+as `docker0`. The `docker0` IP address is used as the default gateway |
|
| 34 |
+for the container. |
|
| 36 | 35 |
|
| 37 | 36 |
# Run a container |
| 38 | 37 |
$ sudo docker run -t -i -d base /bin/bash |
| ... | ... |
@@ -42,9 +41,8 @@ default gateway for the container. |
| 42 | 42 |
bridge name bridge id STP enabled interfaces |
| 43 | 43 |
docker0 8000.fef213db5a66 no vethQCDY1N |
| 44 | 44 |
|
| 45 |
-Above, `docker0` acts as a bridge for the |
|
| 46 |
-`vethQCDY1N` interface which is dedicated to the |
|
| 47 |
-52f811c5d3d6 container. |
|
| 45 |
+Above, `docker0` acts as a bridge for the `vethQCDY1N` interface which |
|
| 46 |
+is dedicated to the 52f811c5d3d6 container. |
|
| 48 | 47 |
|
| 49 | 48 |
## How to use a specific IP address range |
| 50 | 49 |
|
| ... | ... |
@@ -62,9 +62,8 @@ combinations of options for TCP port are the following: |
| 62 | 62 |
# Bind TCP port 8080 of the container to a dynamically allocated TCP port on all available interfaces of the host machine. |
| 63 | 63 |
docker run -p 8080 <image> <cmd> |
| 64 | 64 |
|
| 65 |
-UDP ports can also be bound by adding a trailing `/udp` |
|
| 66 |
-.literal}. All the combinations described for TCP work. Here is only one |
|
| 67 |
-example: |
|
| 65 |
+UDP ports can also be bound by adding a trailing `/udp`. All the |
|
| 66 |
+combinations described for TCP work. Here is only one example: |
|
| 68 | 67 |
|
| 69 | 68 |
# Bind UDP port 5353 of the container to UDP port 53 on 127.0.0.1 of the host machine. |
| 70 | 69 |
docker run -p 127.0.0.1:53:5353/udp <image> <cmd> |
| ... | ... |
@@ -112,16 +111,14 @@ a Dockerfile: |
| 112 | 112 |
# Expose port 80 |
| 113 | 113 |
docker run --expose 80 --name server <image> <cmd> |
| 114 | 114 |
|
| 115 |
-The `client` then links to the `server` |
|
| 116 |
-.literal}: |
|
| 115 |
+The `client` then links to the `server`: |
|
| 117 | 116 |
|
| 118 | 117 |
# Link |
| 119 | 118 |
docker run --name client --link server:linked-server <image> <cmd> |
| 120 | 119 |
|
| 121 | 120 |
`client` locally refers to `server` |
| 122 | 121 |
as `linked-server`. The following |
| 123 |
-environment variables, among others, are available on `client` |
|
| 124 |
-.literal}: |
|
| 122 |
+environment variables, among others, are available on `client`: |
|
| 125 | 123 |
|
| 126 | 124 |
# The default protocol, ip, and port of the service running in the container |
| 127 | 125 |
LINKED-SERVER_PORT=tcp://172.17.0.8:80 |
| ... | ... |
@@ -109,8 +109,7 @@ container. Similarly, some daemons (such as `sshd`) |
| 109 | 109 |
will scrub them when spawning shells for connection. |
| 110 | 110 |
|
| 111 | 111 |
You can work around this by storing the initial `env` |
| 112 |
-in a file, or looking at `/proc/1/environ` |
|
| 113 |
-.literal}. |
|
| 112 |
+in a file, or looking at `/proc/1/environ`. |
|
| 114 | 113 |
|
| 115 | 114 |
Running `docker ps` shows the 2 containers, and the |
| 116 | 115 |
`webapp/db` alias name for the Redis container. |