From 362e94b2bca42da5dc833175e13d02935c26d25b Mon Sep 17 00:00:00 2001 From: "Benjamin R. Haskell" Date: Fri, 7 Oct 2016 00:39:15 -0400 Subject: [PATCH] Disable Liquid templating for blocks with `{{` Instead of disabling templating for entire files, fix instances individually by wrapping blocks in: ```{% raw %} ... content ... {% endraw %}``` Signed-off-by: Benjamin R. Haskell --- engine/admin/formatting.md | 12 ++++++++++++ engine/admin/logging/fluentd.md | 2 ++ engine/admin/logging/log_tags.md | 8 ++++++-- engine/admin/logging/overview.md | 4 ++-- engine/admin/logging/splunk.md | 4 ++++ engine/deprecated.md | 2 ++ .../reference/api/docker_remote_api_v1.18.md | 14 ++++++++++++++ .../reference/api/docker_remote_api_v1.19.md | 14 ++++++++++++++ .../reference/api/docker_remote_api_v1.20.md | 18 ++++++++++++++++++ .../reference/api/docker_remote_api_v1.21.md | 18 ++++++++++++++++++ .../reference/api/docker_remote_api_v1.22.md | 18 ++++++++++++++++++ .../reference/api/docker_remote_api_v1.23.md | 18 ++++++++++++++++++ .../reference/api/docker_remote_api_v1.24.md | 16 ++++++++++++++++ .../reference/api/docker_remote_api_v1.25.md | 16 ++++++++++++++++ engine/reference/commandline/cli.md | 2 ++ engine/reference/commandline/commit.md | 2 ++ engine/reference/commandline/images.md | 4 ++++ engine/reference/commandline/inspect.md | 14 ++++++++++++++ engine/reference/commandline/node_inspect.md | 2 ++ engine/reference/commandline/ps.md | 12 +++++++++--- .../reference/commandline/service_inspect.md | 4 ++-- engine/reference/commandline/version.md | 4 ++++ engine/reference/commandline/volume_inspect.md | 2 ++ engine/reference/run.md | 6 ++++++ engine/swarm/admin_guide.md | 8 ++++---- engine/swarm/ingress.md | 4 ++-- engine/swarm/networking.md | 4 ++-- engine/tutorials/networkingcontainers.md | 6 ++++++ engine/tutorials/usingdocker.md | 2 ++ .../networking/default_network/dockerlinks.md | 2 ++ .../userguide/networking/work-with-networks.md | 12 ++++++------ machine/reference/inspect.md | 6 ++++++ machine/reference/ls.md | 4 ++++ 33 files changed, 241 insertions(+), 23 deletions(-) diff --git a/engine/admin/formatting.md b/engine/admin/formatting.md index f927b46abb..58bf0a092a 100644 --- a/engine/admin/formatting.md +++ b/engine/admin/formatting.md @@ -33,34 +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 %} diff --git a/engine/admin/logging/fluentd.md b/engine/admin/logging/fluentd.md index 6c9ab1b4f6..abc9cc639e 100644 --- a/engine/admin/logging/fluentd.md +++ b/engine/admin/logging/fluentd.md @@ -33,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 diff --git a/engine/admin/logging/log_tags.md b/engine/admin/logging/log_tags.md index 6276344e03..a11a6c3678 100644 --- a/engine/admin/logging/log_tags.md +++ b/engine/admin/logging/log_tags.md @@ -23,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. | @@ -34,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 @@ -50,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: diff --git a/engine/admin/logging/overview.md b/engine/admin/logging/overview.md index 8790c2a2b1..17e1ec7b4d 100644 --- a/engine/admin/logging/overview.md +++ b/engine/admin/logging/overview.md @@ -243,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. diff --git a/engine/admin/logging/splunk.md b/engine/admin/logging/splunk.md index c246331e1e..2db55e0f88 100644 --- a/engine/admin/logging/splunk.md +++ b/engine/admin/logging/splunk.md @@ -33,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. | @@ -46,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. @@ -56,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 \ @@ -67,3 +70,4 @@ The `SplunkServerDefaultCert` is automatically generated by Splunk certificates. --env "TEST=false" --label location=west your/application + {% endraw %} diff --git a/engine/deprecated.md b/engine/deprecated.md index 168344ca74..fcbba87289 100644 --- a/engine/deprecated.md +++ b/engine/deprecated.md @@ -106,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)** diff --git a/engine/reference/api/docker_remote_api_v1.18.md b/engine/reference/api/docker_remote_api_v1.18.md index fcc6a4b591..63c3127554 100644 --- a/engine/reference/api/docker_remote_api_v1.18.md +++ b/engine/reference/api/docker_remote_api_v1.18.md @@ -523,7 +523,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -598,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**: @@ -902,7 +906,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -982,7 +988,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1075,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**: @@ -1181,7 +1191,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -1942,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**: diff --git a/engine/reference/api/docker_remote_api_v1.19.md b/engine/reference/api/docker_remote_api_v1.19.md index 6b5a5db9c0..4b045b8719 100644 --- a/engine/reference/api/docker_remote_api_v1.19.md +++ b/engine/reference/api/docker_remote_api_v1.19.md @@ -537,7 +537,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -614,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**: @@ -939,7 +943,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1019,7 +1025,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1112,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**: @@ -1223,7 +1233,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2023,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**: diff --git a/engine/reference/api/docker_remote_api_v1.20.md b/engine/reference/api/docker_remote_api_v1.20.md index 592c7ab2a1..e394e4a768 100644 --- a/engine/reference/api/docker_remote_api_v1.20.md +++ b/engine/reference/api/docker_remote_api_v1.20.md @@ -546,7 +546,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -623,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**: @@ -948,7 +952,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1028,7 +1034,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1123,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**: @@ -1169,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 @@ -1224,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**: @@ -1350,7 +1364,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2176,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**: diff --git a/engine/reference/api/docker_remote_api_v1.21.md b/engine/reference/api/docker_remote_api_v1.21.md index f1de122747..6fb9abe935 100644 --- a/engine/reference/api/docker_remote_api_v1.21.md +++ b/engine/reference/api/docker_remote_api_v1.21.md @@ -615,7 +615,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -692,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**: @@ -1029,7 +1033,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1109,7 +1115,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1204,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**: @@ -1250,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 @@ -1305,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**: @@ -1431,7 +1445,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2334,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**: diff --git a/engine/reference/api/docker_remote_api_v1.22.md b/engine/reference/api/docker_remote_api_v1.22.md index 235157c7d9..931b7ba45d 100644 --- a/engine/reference/api/docker_remote_api_v1.22.md +++ b/engine/reference/api/docker_remote_api_v1.22.md @@ -740,7 +740,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -817,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**: @@ -1200,7 +1204,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1284,7 +1290,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1382,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**: @@ -1428,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 @@ -1483,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**: @@ -1609,7 +1623,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2728,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**: diff --git a/engine/reference/api/docker_remote_api_v1.23.md b/engine/reference/api/docker_remote_api_v1.23.md index c7118f0d0c..2adfbb5e00 100644 --- a/engine/reference/api/docker_remote_api_v1.23.md +++ b/engine/reference/api/docker_remote_api_v1.23.md @@ -766,7 +766,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -843,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**: @@ -1233,7 +1237,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1317,7 +1323,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1415,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**: @@ -1461,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 @@ -1516,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**: @@ -1642,7 +1656,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2802,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**: diff --git a/engine/reference/api/docker_remote_api_v1.24.md b/engine/reference/api/docker_remote_api_v1.24.md index 1d9fe1c7a0..58ffa38397 100644 --- a/engine/reference/api/docker_remote_api_v1.24.md +++ b/engine/reference/api/docker_remote_api_v1.24.md @@ -798,7 +798,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -876,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**: @@ -1262,7 +1266,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1346,7 +1352,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1460,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 @@ -1515,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**: @@ -1643,7 +1655,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2816,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**: diff --git a/engine/reference/api/docker_remote_api_v1.25.md b/engine/reference/api/docker_remote_api_v1.25.md index 1cd58ac86e..ec2ec480f6 100644 --- a/engine/reference/api/docker_remote_api_v1.25.md +++ b/engine/reference/api/docker_remote_api_v1.25.md @@ -805,7 +805,9 @@ Get `stdout` and `stderr` logs from the container ``id`` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -883,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**: @@ -1269,7 +1273,9 @@ Attach to the container `id` Connection: Upgrade Upgrade: tcp + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1353,7 +1359,9 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet **Example response** + {% raw %} {{ STREAM }} + {% endraw %} **Query parameters**: @@ -1467,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 @@ -1522,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**: @@ -1650,7 +1662,9 @@ Build an image from a Dockerfile POST /build HTTP/1.1 + {% raw %} {{ TAR STREAM }} + {% endraw %} **Example response**: @@ -2832,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**: diff --git a/engine/reference/commandline/cli.md b/engine/reference/commandline/cli.md index f4b685afd6..b78f7aad52 100644 --- a/engine/reference/commandline/cli.md +++ b/engine/reference/commandline/cli.md @@ -145,6 +145,7 @@ directives, see the [**Formatting** section in the `docker images` documentation Following is a sample `config.json` file: + {% raw %} { "HttpHeaders": { "MyHeader": "MyValue" @@ -153,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 diff --git a/engine/reference/commandline/commit.md b/engine/reference/commandline/commit.md index 45a39ba69a..72b4422f98 100644 --- a/engine/reference/commandline/commit.md +++ b/engine/reference/commandline/commit.md @@ -55,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 @@ -65,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 diff --git a/engine/reference/commandline/images.md b/engine/reference/commandline/images.md index fb5252f6cd..494b23bc8a 100644 --- a/engine/reference/commandline/images.md +++ b/engine/reference/commandline/images.md @@ -249,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: b6fa739cedf5: committ @@ -259,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 @@ -274,3 +277,4 @@ can use: 746b819f315e postgres 9.3 746b819f315e postgres 9.3.5 746b819f315e postgres latest + {% endraw %} diff --git a/engine/reference/commandline/inspect.md b/engine/reference/commandline/inspect.md index 55bc7c4210..f6a904b675 100644 --- a/engine/reference/commandline/inspect.md +++ b/engine/reference/commandline/inspect.md @@ -36,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:** @@ -70,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:** @@ -79,4 +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 %} diff --git a/engine/reference/commandline/node_inspect.md b/engine/reference/commandline/node_inspect.md index aff088bf0f..f7578997bd 100644 --- a/engine/reference/commandline/node_inspect.md +++ b/engine/reference/commandline/node_inspect.md @@ -95,8 +95,10 @@ Example output: } ] + {% raw %} $ docker node inspect --format '{{ .ManagerStatus.Leader }}' self false + {% endraw %} $ docker node inspect --pretty self ID: e216jshn25ckzbvmwlnh5jr3g diff --git a/engine/reference/commandline/ps.md b/engine/reference/commandline/ps.md index 818f4deba5..94cd6a58de 100644 --- a/engine/reference/commandline/ps.md +++ b/engine/reference/commandline/ps.md @@ -275,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 @@ -283,7 +283,7 @@ CONTAINER ID MOUNTS $ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}" CONTAINER ID MOUNTS 9c3527ed70ce remote-volume -``` +{% endraw %}``` #### Network @@ -308,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 @@ -337,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 @@ -348,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 @@ -359,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 diff --git a/engine/reference/commandline/service_inspect.md b/engine/reference/commandline/service_inspect.md index 195426b0c4..53e2e838fd 100644 --- a/engine/reference/commandline/service_inspect.md +++ b/engine/reference/commandline/service_inspect.md @@ -139,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 diff --git a/engine/reference/commandline/version.md b/engine/reference/commandline/version.md index bbccec9c1a..c1b2ba6bac 100644 --- a/engine/reference/commandline/version.md +++ b/engine/reference/commandline/version.md @@ -49,10 +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 %} diff --git a/engine/reference/commandline/volume_inspect.md b/engine/reference/commandline/volume_inspect.md index 5539a3af6a..aa13773d18 100644 --- a/engine/reference/commandline/volume_inspect.md +++ b/engine/reference/commandline/volume_inspect.md @@ -40,8 +40,10 @@ Example output: } ] + {% raw %} $ docker volume inspect --format '{{ .Mountpoint }}' 85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d /var/lib/docker/volumes/85bffb0677236974f93955d8ecc4df55ef5070117b0e53333cc1b443777be24d/_data + {% endraw %} ## Related information diff --git a/engine/reference/run.md b/engine/reference/run.md index 2be54ea8eb..6cf29dfc7e 100644 --- a/engine/reference/run.md +++ b/engine/reference/run.md @@ -539,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 @@ -1402,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 \ @@ -1446,6 +1451,7 @@ Example: } ] } + {% endraw %} The health status is also displayed in the `docker ps` output. diff --git a/engine/swarm/admin_guide.md b/engine/swarm/admin_guide.md index 97cdcbbcf0..15ce1faf15 100644 --- a/engine/swarm/admin_guide.md +++ b/engine/swarm/admin_guide.md @@ -166,17 +166,17 @@ for more information. From the command line, run `docker node inspect ` 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. diff --git a/engine/swarm/ingress.md b/engine/swarm/ingress.md index 02f7f464f6..a1e99ff6ac 100644 --- a/engine/swarm/ingress.md +++ b/engine/swarm/ingress.md @@ -79,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 `` from the containers and the `` where nodes listen for requests for the service. diff --git a/engine/swarm/networking.md b/engine/swarm/networking.md index 381c50e0d8..88966ad54f 100644 --- a/engine/swarm/networking.md +++ b/engine/swarm/networking.md @@ -175,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` diff --git a/engine/tutorials/networkingcontainers.md b/engine/tutorials/networkingcontainers.md index 8e5ed3b81d..65c2a5d88c 100644 --- a/engine/tutorials/networkingcontainers.md +++ b/engine/tutorials/networkingcontainers.md @@ -203,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"}} @@ -214,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 diff --git a/engine/tutorials/usingdocker.md b/engine/tutorials/usingdocker.md index 775810d89e..f94bbf7d01 100644 --- a/engine/tutorials/usingdocker.md +++ b/engine/tutorials/usingdocker.md @@ -250,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 diff --git a/engine/userguide/networking/default_network/dockerlinks.md b/engine/userguide/networking/default_network/dockerlinks.md index 68306df4e3..280891a984 100644 --- a/engine/userguide/networking/default_network/dockerlinks.md +++ b/engine/userguide/networking/default_network/dockerlinks.md @@ -190,7 +190,9 @@ example as: Next, inspect your linked containers with `docker inspect`: + {% raw %} $ docker inspect -f "{{ .HostConfig.Links }}" web + {% endraw %} [/db:/web/db] diff --git a/engine/userguide/networking/work-with-networks.md b/engine/userguide/networking/work-with-networks.md index 3719ecc51c..d6ec3946f5 100644 --- a/engine/userguide/networking/work-with-networks.md +++ b/engine/userguide/networking/work-with-networks.md @@ -264,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 { @@ -301,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 @@ -751,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 @@ -800,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 diff --git a/machine/reference/inspect.md b/machine/reference/inspect.md index 773407c957..1358f0e20c 100644 --- a/machine/reference/inspect.md +++ b/machine/reference/inspect.md @@ -55,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": "", @@ -87,3 +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 %} diff --git a/machine/reference/ls.md b/machine/reference/ls.md index e13199b8e3..c6ac98ff06 100644 --- a/machine/reference/ls.md +++ b/machine/reference/ls.md @@ -96,13 +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 %}