Merge pull request #114 from benizi/fix/raw-variables-targeted

Prevent Liquid from mangling `{{` in a more targeted way
This commit is contained in:
John Mulhausen 2016-10-07 13:30:05 -07:00 committed by GitHub
commit 8bfa1bda07
35 changed files with 241 additions and 163 deletions

View File

@ -1,5 +1,3 @@
{% raw %}
# Nodes
## Node
@ -376,5 +374,3 @@ Available in Docker Cloud's **REST API**
Parameter | Description
--------- | -----------
uuid | The UUID of the node to terminate
{% endraw %}

View File

@ -1,5 +1,3 @@
{% raw %}
# Stacks
## Stack
@ -568,5 +566,3 @@ Available in Docker Cloud's **REST API**
Parameter | Description
--------- | -----------
uuid | The UUID of the stack to terminate
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Format command and log output
---
{% raw %}
# Formatting reference
Docker uses [Go templates](https://golang.org/pkg/text/template/) to allow users manipulate the output format
@ -35,36 +33,46 @@ This is the complete list of the available functions with examples:
Join concatenates a list of strings to create a single string.
It puts a separator between each element in the list.
{% raw %}
$ docker ps --format '{{join .Names " or "}}'
{% endraw %}
### Json
Json encodes an element as a json string.
{% raw %}
$ docker inspect --format '{{json .Mounts}}' container
{% endraw %}
### Lower
Lower turns a string into its lower case representation.
{% raw %}
$ docker inspect --format "{{lower .Name}}" container
{% endraw %}
### Split
Split slices a string into a list of strings separated by a separator.
{% raw %}
# docker inspect --format '{{split (join .Names "/") "/"}}' container
{% endraw %}
### Title
Title capitalizes a string.
{% raw %}
$ docker inspect --format "{{title .Name}}" container
{% endraw %}
### Upper
Upper turns a string into its upper case representation.
{% raw %}
$ docker inspect --format "{{upper .Name}}" container
{% endraw %}
{% endraw %}

View File

@ -10,8 +10,6 @@ menu:
title: Fluentd logging driver
---
{% raw %}
# Fluentd logging driver
The `fluentd` logging driver sends container logs to the
@ -35,8 +33,10 @@ The `docker logs` command is not available for this logging driver.
Some options are supported by specifying `--log-opt` as many times as needed:
{% raw %}
- `fluentd-address`: specify `host:port` to connect `localhost:24224`
- `tag`: specify tag for fluentd message, which interpret some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`
{% endraw %}
Configure the default logging driver by passing the
@ -115,5 +115,3 @@ aggregate store.
3. Start one or more containers with the `fluentd` logging driver:
$ docker run --log-driver=fluentd your/application
{% endraw %}

View File

@ -11,8 +11,6 @@ menu:
title: Log tags for logging driver
---
{% raw %}
# Log Tags
The `tag` log option specifies how to format a tag that identifies the
@ -25,6 +23,7 @@ docker run --log-driver=fluentd --log-opt fluentd-address=myhost.local:24224 --l
Docker supports some special template markup you can use when specifying a tag's value:
{% raw %}
| Markup | Description |
|--------------------|------------------------------------------------------|
| `{{.ID}}` | The first 12 characters of the container id. |
@ -36,15 +35,18 @@ Docker supports some special template markup you can use when specifying a tag's
| `{{.DaemonName}}` | The name of the docker program (`docker`). |
For example, specifying a `--log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"` value yields `syslog` log lines like:
{% endraw %}
```
Aug 7 18:33:19 HOSTNAME docker/hello-world/foobar/5790672ab6a0[9103]: Hello from Docker.
```
{% raw %}
At startup time, the system sets the `container_name` field and `{{.Name}}` in
the tags. If you use `docker rename` to rename a container, the new name is not
reflected in the log messages. Instead, these messages continue to use the
original container name.
{% endraw %}
For advanced usage, the generated tag's use [go
templates](http://golang.org/pkg/text/template/) and the container's [logging
@ -52,14 +54,14 @@ context](https://github.com/docker/docker/blob/master/daemon/logger/context.go).
As an example of what is possible with the syslog logger:
```
```{% raw %}
$ docker run -it --rm \
--log-driver syslog \
--log-opt tag="{{ (.ExtraAttributes nil).SOME_ENV_VAR }}" \
--log-opt env=SOME_ENV_VAR \
-e SOME_ENV_VAR=logtester.1234 \
flyinprogrammer/logtester
```
{% endraw %}```
Results in logs like this:
@ -68,5 +70,3 @@ Apr 1 15:22:17 ip-10-27-39-73 docker/logtester.1234[45499]: + exec app
Apr 1 15:22:17 ip-10-27-39-73 docker/logtester.1234[45499]: 2016-04-01 15:22:17.075416751 +0000 UTC stderr msg: 1
```
{% endraw %}

View File

@ -11,8 +11,6 @@ menu:
title: Configuring Logging Drivers
---
{% raw %}
# Configure logging drivers
The container can have a different logging driver than the Docker daemon. Use
@ -245,13 +243,13 @@ logging driver options.
For example, to specify both additional options:
```bash
```bash{% raw %}
$ docker run -dit \
--log-driver=fluentd \
--log-opt fluentd-address=localhost:24224 \
--log-opt tag="docker.{{.Name}}" \
alpine sh
```
{% endraw %}```
If container cannot connect to the Fluentd daemon on the specified address and
`fluentd-async-connect` is not enabled, the container stops immediately.
@ -307,5 +305,3 @@ The Google Cloud Logging driver supports the following options:
For detailed information about working with this logging driver, see the
[Google Cloud Logging driver](gcplogs.md). reference documentation.
{% endraw %}

View File

@ -10,8 +10,6 @@ menu:
title: Splunk logging driver
---
{% raw %}
# Splunk logging driver
The `splunk` logging driver sends container logs to
@ -35,6 +33,7 @@ You can set the logging driver for a specific container by using the
You can use the `--log-opt NAME=VALUE` flag to specify these additional Splunk
logging driver options:
{% raw %}
| Option | Required | Description |
|-----------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `splunk-token` | required | Splunk HTTP Event Collector token. |
@ -48,6 +47,7 @@ logging driver options:
| `tag` | optional | Specify tag for message, which interpret some markup. Default value is `{{.ID}}` (12 characters of the container ID). Refer to the [log tag option documentation](log_tags.md) for customizing the log tag format. |
| `labels` | optional | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container. |
| `env` | optional | Comma-separated list of keys of environment variables, which should be included in message, if these variables are specified for container. |
{% endraw %}
If there is collision between `label` and `env` keys, the value of the `env` takes precedence.
Both options add additional fields to the attributes of a logging message.
@ -58,6 +58,7 @@ Docker daemon is running. The path to the root certificate and Common Name is
specified using an HTTPS scheme. This is used for verification.
The `SplunkServerDefaultCert` is automatically generated by Splunk certificates.
{% raw %}
docker run --log-driver=splunk \
--log-opt splunk-token=176FCEBF-4CF5-4EDF-91BC-703796522D20 \
--log-opt splunk-url=https://splunkhost:8088 \
@ -69,5 +70,4 @@ The `SplunkServerDefaultCert` is automatically generated by Splunk certificates.
--env "TEST=false"
--label location=west
your/application
{% endraw %}
{% endraw %}

View File

@ -11,8 +11,6 @@ menu:
title: Deprecated Engine Features
---
{% raw %}
# Deprecated Engine Features
The following list of features are deprecated in Engine.
@ -108,7 +106,9 @@ Log tags are now generated in a standard way across different logging drivers.
Because of which, the driver specific log tag options `syslog-tag`, `gelf-tag` and
`fluentd-tag` have been deprecated in favor of the generic `tag` option.
{% raw %}
docker --log-driver=syslog --log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"
{% endraw %}
### LXC built-in exec driver
**Deprecated In Release: [v1.8.0](https://github.com/docker/docker/releases/tag/v1.8.0)**
@ -189,5 +189,3 @@ Since 1.9, Docker Content Trust Offline key has been renamed to Root key and the
- DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE is now named DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE
- DOCKER_CONTENT_TRUST_TAGGING_PASSPHRASE is now named DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.18
---
{% raw %}
# Docker Remote API v1.18
## 1. Brief introduction
@ -525,7 +523,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -600,7 +600,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -904,7 +906,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -984,7 +988,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1077,7 +1083,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1183,7 +1191,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1944,7 +1954,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -2135,5 +2147,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.19
---
{% raw %}
# Docker Remote API v1.19
## 1. Brief introduction
@ -539,7 +537,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -616,7 +616,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -941,7 +943,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1021,7 +1025,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1114,7 +1120,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1225,7 +1233,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2025,7 +2035,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -2215,5 +2227,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.20
---
{% raw %}
# Docker Remote API v1.20
## 1. Brief introduction
@ -548,7 +546,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -625,7 +625,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -950,7 +952,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1030,7 +1034,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1125,7 +1131,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1171,7 +1179,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1226,7 +1236,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1352,7 +1364,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2178,7 +2192,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -2366,5 +2382,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.21
---
{% raw %}
# Docker Remote API v1.21
## 1. Brief introduction
@ -617,7 +615,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -694,7 +694,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1031,7 +1033,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1111,7 +1115,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1206,7 +1212,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1252,7 +1260,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1307,7 +1317,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1433,7 +1445,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2336,7 +2350,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -2937,5 +2953,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.22
---
{% raw %}
# Docker Remote API v1.22
## 1. Brief introduction
@ -742,7 +740,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -819,7 +819,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1202,7 +1204,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1286,7 +1290,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1384,7 +1390,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1430,7 +1438,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1485,7 +1495,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1611,7 +1623,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2730,7 +2744,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -3273,5 +3289,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.23
---
{% raw %}
# Docker Remote API v1.23
## 1. Brief introduction
@ -768,7 +766,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -845,7 +845,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1235,7 +1237,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1319,7 +1323,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1417,7 +1423,9 @@ Copy files or folders of container `id`
HTTP/1.1 200 OK
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1463,7 +1471,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1518,7 +1528,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1644,7 +1656,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2804,7 +2818,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -3389,5 +3405,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Remote API v1.24
---
{% raw %}
# Docker Remote API v1.24
# 1. Brief introduction
@ -800,7 +798,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -878,7 +878,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1264,7 +1266,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1348,7 +1352,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1462,7 +1468,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1517,7 +1525,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1645,7 +1655,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2818,7 +2830,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -5247,5 +5261,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -10,8 +10,6 @@ menu:
title: Remote API v1.25
---
{% raw %}
# Docker Remote API v1.25
# 1. Brief introduction
@ -807,7 +805,9 @@ Get `stdout` and `stderr` logs from the container ``id``
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -885,7 +885,9 @@ Export the contents of container `id`
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Status codes**:
@ -1271,7 +1273,9 @@ Attach to the container `id`
Connection: Upgrade
Upgrade: tcp
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1355,7 +1359,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
**Example response**
{% raw %}
{{ STREAM }}
{% endraw %}
**Query parameters**:
@ -1469,7 +1475,9 @@ Get a tar archive of a resource in the filesystem of container `id`.
Content-Type: application/x-tar
X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
{% raw %}
{{ TAR STREAM }}
{% endraw %}
On success, a response header `X-Docker-Container-Path-Stat` will be set to a
base64-encoded JSON object containing some filesystem header information about
@ -1524,7 +1532,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
Content-Type: application/x-tar
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -1652,7 +1662,9 @@ Build an image from a Dockerfile
POST /build HTTP/1.1
{% raw %}
{{ TAR STREAM }}
{% endraw %}
**Example response**:
@ -2834,7 +2846,9 @@ interactive session with the `exec` command.
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
{% raw %}
{{ STREAM }}
{% endraw %}
**JSON parameters**:
@ -5283,5 +5297,3 @@ To set cross origin requests to the remote api please give values to
default or blank means CORS disabled
$ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Use the Docker command line
---
{% raw %}
# Use the Docker command line
To list available commands, either run `docker` with no parameters
@ -147,6 +145,7 @@ directives, see the [**Formatting** section in the `docker images` documentation
Following is a sample `config.json` file:
{% raw %}
{
"HttpHeaders": {
"MyHeader": "MyValue"
@ -155,6 +154,7 @@ Following is a sample `config.json` file:
"imagesFormat": "table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.CreatedAt}}",
"detachKeys": "ctrl-e,e"
}
{% endraw %}
### Notary
@ -224,5 +224,3 @@ Sometimes, multiple options can call for a more complex value string as for
Options like `--name=""` expect a string, and they
can only be specified once. Options like `-c=0`
expect an integer, and they can only be specified once.
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: commit
---
{% raw %}
# commit
```markdown
@ -57,6 +55,7 @@ created. Supported `Dockerfile` instructions:
## Commit a container with new configurations
{% raw %}
$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours
@ -67,6 +66,7 @@ created. Supported `Dockerfile` instructions:
f5283438590d
$ docker inspect -f "{{ .Config.Env }}" f5283438590d
[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true]
{% endraw %}
## Commit a container with new `CMD` and `EXPOSE` instructions
@ -86,5 +86,3 @@ created. Supported `Dockerfile` instructions:
89373736e2e7 testimage:version4 "apachectl -DFOREGROU" 3 seconds ago Up 2 seconds 80/tcp
c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours
197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: images
---
{% raw %}
# images
```markdown
@ -251,6 +249,7 @@ output the data exactly as the template declares or, when using the
The following example uses a template without headers and outputs the
`ID` and `Repository` entries separated by a colon for all images:
{% raw %}
$ docker images --format "{{.ID}}: {{.Repository}}"
77af4d6b9913: <none>
b6fa739cedf5: committ
@ -261,10 +260,12 @@ The following example uses a template without headers and outputs the
746b819f315e: postgres
746b819f315e: postgres
746b819f315e: postgres
{% endraw %}
To list all images with their repository and tag in a table format you
can use:
{% raw %}
$ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
IMAGE ID REPOSITORY TAG
77af4d6b9913 <none> <none>
@ -276,5 +277,4 @@ can use:
746b819f315e postgres 9.3
746b819f315e postgres 9.3.5
746b819f315e postgres latest
{% endraw %}
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: inspect
---
{% raw %}
# inspect
```markdown
@ -38,29 +36,39 @@ describes all the details of the format.
For the most part, you can pick out any field from the JSON in a fairly
straightforward manner.
{% raw %}
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID
{% endraw %}
**Get an instance's MAC address:**
For the most part, you can pick out any field from the JSON in a fairly
straightforward manner.
{% raw %}
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' $INSTANCE_ID
{% endraw %}
**Get an instance's log path:**
{% raw %}
$ docker inspect --format='{{.LogPath}}' $INSTANCE_ID
{% endraw %}
**Get a Task's image name:**
{% raw %}
$ docker inspect --format='{{.Container.Spec.Image}}' $INSTANCE_ID
{% endraw %}
**List all port bindings:**
One can loop over arrays and maps in the results to produce simple text
output:
{% raw %}
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
{% endraw %}
**Find a specific port mapping:**
@ -72,7 +80,9 @@ numeric public port, you use `index` to find the specific port map, and
then `index` 0 contains the first object inside of that. Then we ask for
the `HostPort` field to get the public address.
{% raw %}
$ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
{% endraw %}
**Get a subsection in JSON format:**
@ -81,6 +91,6 @@ fields, by default you get a Go-style dump of the inner values.
Docker adds a template function, `json`, which can be applied to get
results in JSON format.
{% raw %}
$ docker inspect --format='{{json .Config}}' $INSTANCE_ID
{% endraw %}
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: node inspect
---
{% raw %}
**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes.
# node inspect
@ -97,8 +95,10 @@ Example output:
}
]
{% raw %}
$ docker node inspect --format '{{ .ManagerStatus.Leader }}' self
false
{% endraw %}
$ docker node inspect --pretty self
ID: e216jshn25ckzbvmwlnh5jr3g
@ -128,5 +128,3 @@ Example output:
* [node ps](node_ps.md)
* [node ls](node_ls.md)
* [node rm](node_rm.md)
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: ps
---
{% raw %}
# ps
```markdown
@ -277,7 +275,7 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
The `volume` filter shows only containers that mount a specific volume or have
a volume mounted in a specific path:
```bash
```bash{% raw %}
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID MOUNTS
9c3527ed70ce remote-volume
@ -285,7 +283,7 @@ CONTAINER ID MOUNTS
$ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID MOUNTS
9c3527ed70ce remote-volume
```
{% endraw %}```
#### Network
@ -310,7 +308,9 @@ example shows all containers that are attached to the `net1` network, using
the network id as a filter;
```bash
{% raw %}
$ docker network inspect --format "{{.ID}}" net1
{% endraw %}
8c0b4110ae930dbe26b258de9bc34a03f98056ed6f27f991d32919bfe401d7c5
@ -339,7 +339,7 @@ Placeholder | Description
`.Size` | Container disk size.
`.Names` | Container names.
`.Labels` | All labels assigned to the container.
`.Label` | Value of a specific label for this container. For example `'{{.Label "com.docker.swarm.cpu"}}'`
`.Label` | Value of a specific label for this container. For example `'{% raw %}{{.Label "com.docker.swarm.cpu"}}{% endraw %}'`
`.Mounts` | Names of the volumes mounted in this container.
When using the `--format` option, the `ps` command will either output the data
@ -350,7 +350,9 @@ The following example uses a template without headers and outputs the `ID` and
`Command` entries separated by a colon for all running containers:
```bash
{% raw %}
$ docker ps --format "{{.ID}}: {{.Command}}"
{% endraw %}
a87ecb4f327c: /bin/sh -c #(nop) MA
01946d9d34d8: /bin/sh -c #(nop) MA
@ -361,7 +363,9 @@ c1d3b0166030: /bin/sh -c yum -y up
To list all running containers with their labels in a table format you can use:
```bash
{% raw %}
$ docker ps --format "table {{.ID}}\t{{.Labels}}"
{% endraw %}
CONTAINER ID LABELS
a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
@ -369,5 +373,3 @@ a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6
41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd
```
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: service inspect
---
{% raw %}
**Warning:** this command is part of the Swarm management feature introduced in Docker 1.12, and might be subject to non backward-compatible changes.
# service inspect
@ -141,10 +139,10 @@ The `--format` option can be used to obtain specific information about a
service. For example, the following command outputs the number of replicas
of the "redis" service.
```bash
```bash{% raw %}
$ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis
10
```
{% endraw %}```
## Related information
@ -155,5 +153,3 @@ $ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis
* [service scale](service_scale.md)
* [service ps](service_ps.md)
* [service update](service_update.md)
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: version
---
{% raw %}
# version
```markdown
@ -51,12 +49,14 @@ describes all the details of the format.
**Get server version:**
{% raw %}
$ docker version --format '{{.Server.Version}}'
1.8.0
{% endraw %}
**Dump raw data:**
{% raw %}
$ docker version --format '{{json .}}'
{"Client":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"},"ServerOK":true,"Server":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","KernelVersion":"3.13.2-gentoo","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"}}
{% endraw %}
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: volume inspect
---
{% raw %}
# volume inspect
```markdown
@ -42,8 +40,10 @@ Example output:
}
]
{% raw %}
$ docker volume inspect --format '{{ .Mountpoint }}' 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d
/var/lib/docker/volumes/85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d/_data
{% endraw %}
## Related information
@ -51,5 +51,3 @@ Example output:
* [volume ls](volume_ls.md)
* [volume rm](volume_rm.md)
* [Understand Data Volumes](../../tutorials/dockervolumes.md)
{% endraw %}

View File

@ -11,8 +11,6 @@ menu:
title: Docker run reference
---
{% raw %}
# Docker run reference
Docker runs processes in isolated containers. A container is a process
@ -541,13 +539,17 @@ will try forever to restart the container. The number of (attempted) restarts
for a container can be obtained via [`docker inspect`](commandline/inspect.md). For example, to get the number of restarts
for container "my-container";
{% raw %}
$ docker inspect -f "{{ .RestartCount }}" my-container
# 2
{% endraw %}
Or, to get the last time the container was (re)started;
{% raw %}
$ docker inspect -f "{{ .State.StartedAt }}" my-container
# 2015-03-04T23:47:07.691840179Z
{% endraw %}
Combining `--restart` (restart policy) with the `--rm` (clean up) flag results
@ -1404,6 +1406,7 @@ Similarly the operator can set the **hostname** with `-h`.
Example:
{% raw %}
$ docker run --name=test -d \
--health-cmd='stat /etc/passwd || exit 1' \
--health-interval=2s \
@ -1448,6 +1451,7 @@ Example:
}
]
}
{% endraw %}
The health status is also displayed in the `docker ps` output.
@ -1533,5 +1537,3 @@ root directory (`/`), but the developer can set a different default with the
Dockerfile `WORKDIR` command. The operator can override this with:
-w="": Working directory inside the container
{% endraw %}

View File

@ -12,8 +12,6 @@ menu:
title: Swarm administration guide
---
{% raw %}
# Administer and maintain a swarm of Docker Engines
When you run a swarm of Docker Engines, **manager nodes** are the key components
@ -168,17 +166,17 @@ for more information.
From the command line, run `docker node inspect <id-node>` to query the nodes.
For instance, to query the reachability of the node as a manager:
```bash
```bash{% raw %}
docker node inspect manager1 --format "{{ .ManagerStatus.Reachability }}"
reachable
```
{% endraw %}```
To query the status of the node as a worker that accept tasks:
```bash
```bash{% raw %}
docker node inspect manager1 --format "{{ .Status.State }}"
ready
```
{% endraw %}```
From those commands, we can see that `manager1` is both at the status
`reachable` as a manager and `ready` as a worker.
@ -264,5 +262,3 @@ The `--force-new-cluster` flag puts the Docker Engine into swarm mode as a
manager node of a single-node swarm. It discards swarm membership information
that existed before the loss of the quorum but it retains data necessary to the
Swarm such as services, tasks and the list of worker nodes.
{% endraw %}

View File

@ -15,8 +15,6 @@ menu:
title: Use swarm mode routing mesh
---
{% raw %}
# Use swarm mode routing mesh
Docker Engine swarm mode makes it easy to publish ports for services to make
@ -81,11 +79,11 @@ $ docker service update \
You can use `docker service inspect` to view the service's published port. For
instance:
```bash
```bash{% raw %}
$ docker service inspect --format="{{json .Endpoint.Spec.Ports}}" my-web
[{"Protocol":"tcp","TargetPort":80,"PublishedPort":8080}]
```
{% endraw %}```
The output shows the `<TARGET-PORT>` from the containers and the
`<PUBLISHED-PORT>` where nodes listen for requests for the service.
@ -137,5 +135,3 @@ To learn more about HAProxy, see the [HAProxy documentation](https://cbonte.gith
## Learn more
* [Deploy services to a swarm](services.md)
{% endraw %}

View File

@ -13,8 +13,6 @@ menu:
title: Attach services to an overlay network
---
{% raw %}
# Attach services to an overlay network
Docker Engine swarm mode natively supports **overlay networks**, so you can
@ -177,13 +175,13 @@ active tasks.
You can inspect the service to view the virtual IP. For example:
```bash
```bash{% raw %}
$ docker service inspect \
--format='{{json .Endpoint.VirtualIPs}}' \
my-web
[{"NetworkID":"7m2rjx0a97n88wzr4nu8772r3" "Addr":"10.0.0.2/24"}]
```
{% endraw %}```
The following example shows how you can add a `busybox` service on the same
network as the `nginx` service and the busybox service is able to access `nginx`
@ -311,5 +309,3 @@ is not the right tool to confirm VIP connectivity.
* [Swarm administration guide](admin_guide.md)
* [Docker Engine command line reference](../reference/commandline/index.md)
* [Swarm mode tutorial](swarm-tutorial/index.md)
{% endraw %}

View File

@ -12,8 +12,6 @@ menu:
title: Network containers
---
{% raw %}
# Network containers
If you are working your way through the user guide, you just built and ran a
@ -205,7 +203,9 @@ Launch a container running a PostgreSQL database and pass it the `--network=my-b
If you inspect your `my-bridge-network` you'll see it has a container attached.
You can also inspect your container to see where it is connected:
{% raw %}
$ docker inspect --format='{{json .NetworkSettings.Networks}}' db
{% endraw %}
{"my-bridge-network":{"NetworkID":"7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
"EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.18.0.1","IPAddress":"172.18.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
@ -216,14 +216,18 @@ Now, go ahead and start your by now familiar web application. This time leave of
Which network is your `web` application running under? Inspect the application and you'll find it is running in the default `bridge` network.
{% raw %}
$ docker inspect --format='{{json .NetworkSettings.Networks}}' web
{% endraw %}
{"bridge":{"NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
"EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
Then, get the IP address of your `web`
{% raw %}
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web
{% endraw %}
172.17.0.2
@ -263,5 +267,3 @@ The `ping` shows it is contacting a different IP address, the address on the `my
## Next steps
Now that you know how to network containers, see [how to manage data in containers](dockervolumes.md).
{% endraw %}

View File

@ -12,8 +12,6 @@ menu:
title: Run a simple application
---
{% raw %}
# Run a simple application
In the ["*Hello world in a container*"](dockerizing.md) you launched your
@ -252,7 +250,9 @@ You can see a sample of that JSON output.
We can also narrow down the information we want to return by requesting a
specific element, for example to return the container's IP address we would:
{% raw %}
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nostalgic_morse
{% endraw %}
172.17.0.5
@ -322,5 +322,3 @@ Until now you've only used images that you've downloaded from Docker Hub. Next,
you can get introduced to building and sharing our own images.
Go to [Working with Docker Images](dockerimages.md).
{% endraw %}

View File

@ -10,8 +10,6 @@ menu:
title: Legacy container links
---
{% raw %}
# Legacy container links
The information in this section explains legacy container links within the Docker default bridge. This is a `bridge` network named `bridge` created automatically when you install Docker.
@ -192,7 +190,9 @@ example as:
Next, inspect your linked containers with `docker inspect`:
{% raw %}
$ docker inspect -f "{{ .HostConfig.Links }}" web
{% endraw %}
[/db:/web/db]
@ -372,5 +372,3 @@ allowing linked communication to continue.
172.17.0.9 db
# Related information
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: Work with network commands
---
{% raw %}
# Work with network commands
This article provides examples of the network subcommands you can use to
@ -266,15 +264,15 @@ configuration does not change across daemon reload.
Now, inspect the network resources used by `container3`.
```bash
```bash{% raw %}
$ docker inspect --format='{{json .NetworkSettings.Networks}}' container3
{"isolated_nw":{"IPAMConfig":{"IPv4Address":"172.25.3.3"},"NetworkID":"1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b",
"EndpointID":"dffc7ec2915af58cc827d995e6ebdc897342be0420123277103c40ae35579103","Gateway":"172.25.0.1","IPAddress":"172.25.3.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:19:03:03"}}
```
{% endraw %}```
Repeat this command for `container2`. If you have Python installed, you can pretty print the output.
```bash
```bash{% raw %}
$ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
{
@ -303,7 +301,7 @@ $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | pyt
"MacAddress": "02:42:ac:19:00:02"
}
}
```
{% endraw %}```
You should find `container2` belongs to two networks. The `bridge` network
which it joined by default when you launched it and the `isolated_nw` which you
@ -753,7 +751,7 @@ round-trip min/avg/max = 0.072/0.085/0.101 ms
You can disconnect a container from a network using the `docker network
disconnect` command.
```bash
```bash{% raw %}
$ docker network disconnect isolated_nw container2
$ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
@ -802,7 +800,7 @@ $ docker network inspect isolated_nw
"Options": {}
}
]
```
{% endraw %}```
Once a container is disconnected from a network, it cannot communicate with
other containers connected to that network. In this example, `container2` can
@ -928,5 +926,3 @@ f7ab26d71dbd bridge bridge
* [network disconnect](../../reference/commandline/network_disconnect.md)
* [network ls](../../reference/commandline/network_ls.md)
* [network rm](../../reference/commandline/network_rm.md)
{% endraw %}

View File

@ -9,8 +9,6 @@ menu:
title: inspect
---
{% raw %}
# inspect
Usage: docker-machine inspect [OPTIONS] [arg...]
@ -57,20 +55,25 @@ This is the default usage of `inspect`.
For the most part, you can pick out any field from the JSON in a fairly
straightforward manner.
{% raw %}
$ docker-machine inspect --format='{{.Driver.IPAddress}}' dev
192.168.5.99
{% endraw %}
**Formatting details:**
If you want a subset of information formatted as JSON, you can use the `json`
function in the template.
{% raw %}
$ docker-machine inspect --format='{{json .Driver}}' dev-fusion
{"Boot2DockerURL":"","CPUS":8,"CPUs":8,"CaCertPath":"/Users/hairyhenderson/.docker/machine/certs/ca.pem","DiskSize":20000,"IPAddress":"172.16.62.129","ISO":"/Users/hairyhenderson/.docker/machine/machines/dev-fusion/boot2docker-1.5.0-GH747.iso","MachineName":"dev-fusion","Memory":1024,"PrivateKeyPath":"/Users/hairyhenderson/.docker/machine/certs/ca-key.pem","SSHPort":22,"SSHUser":"docker","SwarmDiscovery":"","SwarmHost":"tcp://0.0.0.0:3376","SwarmMaster":false}
{% endraw %}
While this is usable, it's not very human-readable. For this reason, there is
`prettyjson`:
{% raw %}
$ docker-machine inspect --format='{{prettyjson .Driver}}' dev-fusion
{
"Boot2DockerURL": "",
@ -89,5 +92,4 @@ While this is usable, it's not very human-readable. For this reason, there is
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmMaster": false
}
{% endraw %}
{% endraw %}

View File

@ -8,8 +8,6 @@ menu:
title: ls
---
{% raw %}
# ls
Usage: docker-machine ls [OPTIONS] [arg...]
@ -98,15 +96,17 @@ when using the table directive, will include column headers as well.
The following example uses a template without headers and outputs the `Name` and `Driver` entries separated by a colon
for all running machines:
{% raw %}
$ docker-machine ls --format "{{.Name}}: {{.DriverName}}"
default: virtualbox
ec2: amazonec2
{% endraw %}
To list all machine names with their driver in a table format you can use:
{% raw %}
$ docker-machine ls --format "table {{.Name}} {{.DriverName}}"
NAME DRIVER
default virtualbox
ec2 amazonec2
{% endraw %}
{% endraw %}