Skip to content

Commit

Permalink
Merge pull request docker#942 from mstanleyjones/fix_curly_braces
Browse files Browse the repository at this point in the history
Fix double curly braces
  • Loading branch information
Misty Stanley-Jones authored and Misty Stanley-Jones committed Jan 19, 2017
2 parents 50de447 + 46e044e commit 5591272
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 29 deletions.
38 changes: 24 additions & 14 deletions engine/admin/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,51 @@ list of elements they support in their templates:
Docker provides a set of basic functions to manipulate template elements.
This is the complete list of the available functions with examples:

### Join
### `join`

Join concatenates a list of strings to create a single string.
`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`

Json encodes an element as a json string.
`json` encodes an element as a json string.

{% raw %}
$ docker inspect --format '{{json .Mounts}}' container
{% endraw %}

### Lower
### `lower`

Lower turns a string into its lower case representation.
`lower` transforms a string into its lowercase representation.

{% raw %}
$ docker inspect --format "{{lower .Name}}" container
{% endraw %}

### Split
### `split`

Split slices a string into a list of strings separated by a separator.
`split` slices a string into a list of strings separated by a separator.

{% raw %}
# docker inspect --format '{{split (join .Names "/") "/"}}' container
{% endraw %}
$ docker inspect --format '{{split (join .Names "/") "/"}}' container
{% endraw %}

### Title
### `title`

Title capitalizes a string.
`title` capitalizes the first character of a string.

{% raw %}
$ docker inspect --format "{{title .Name}}" container
{% endraw %}

### Upper
### `upper`

Upper turms a string into its upper case representation.
`upper` transforms a string into its uppercase representation.

{% raw %}
$ docker inspect --format "{{upper .Name}}" container
{% endraw %}
2 changes: 1 addition & 1 deletion engine/admin/logging/fluentd.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The `docker logs` command is not available for this logging driver.
Some options are supported by specifying `--log-opt` as many times as needed:

- `fluentd-address`: specify a socket address to connect to the Fluentd daemon, ex `fluentdhost:24224` or `unix:///path/to/fluentd.sock`
- `tag`: specify tag for fluentd message, which interpret some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`
- `tag`: specify tag for fluentd message, which interpret some markup, ex {% raw %}`{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`{% endraw %}


Configure the default logging driver by passing the
Expand Down
24 changes: 14 additions & 10 deletions engine/admin/logging/log_tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ The `tag` log option specifies how to format a tag that identifies the
container's log messages. By default, the system uses the first 12 characters of
the container id. To override this behavior, specify a `tag` option:

```
docker run --log-driver=fluentd --log-opt fluentd-address=myhost.local:24224 --log-opt tag="mailer"
```bash
$ docker run --log-driver=fluentd --log-opt fluentd-address=myhost.local:24224 --log-opt tag="mailer"
```

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. |
Expand All @@ -26,13 +27,15 @@ Docker supports some special template markup you can use when specifying a tag's
| `{{.ImageName}}` | The name of the image used by the container. |
| `{{.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 %}

```
For example, specifying a {% raw %}`--log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"`{% endraw %} value yields `syslog` log lines like:

```none
Aug 7 18:33:19 HOSTNAME docker/hello-world/foobar/5790672ab6a0[9103]: Hello from Docker.
```

At startup time, the system sets the `container_name` field and `{{.Name}}` in
At startup time, the system sets the `container_name` field and {% raw %}`{{.Name}}`{% endraw %} 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.
Expand All @@ -41,20 +44,21 @@ For advanced usage, the generated tag's use [go
templates](http://golang.org/pkg/text/template/) and the container's [logging
context](https://github.com/docker/docker/blob/master/daemon/logger/context.go).

As an example of what is possible with the syslog logger:
As an example of what is possible with the syslog logger, if you use the following
command, you get the output that follows:

```
```bash
{% 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:

```
```none
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
```
8 changes: 4 additions & 4 deletions engine/admin/logging/splunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ logging driver options:
| `splunk-verify-connection` | optional | Verify on start, that docker can connect to Splunk server. Defaults to true. |
| `splunk-gzip` | optional | Enable/disable gzip compression to send events to Splunk Enterprise or Splunk Cloud instance. Defaults to false. |
| `splunk-gzip-level` | optional | Set compression level for gzip. Valid values are -1 (default), 0 (no compression), 1 (best speed) ... 9 (best compression). Defaults to [DefaultCompression](https://golang.org/pkg/compress/gzip/#DefaultCompression). |
| `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. |
| `tag` | optional | Specify tag for message, which interpret some markup. Default value is {% raw %}`{{.ID}}`{% endraw %} (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. |

Expand Down Expand Up @@ -75,7 +75,7 @@ $ docker run --log-driver=splunk \
By default Logging Driver sends messages as `inline` format, where each message
will be embedded as a string, for example

```
```none
{
"attrs": {
"env1": "val1",
Expand All @@ -102,7 +102,7 @@ will try to parse every line as a JSON object and send it as embedded object. In
case if it cannot parse it - message will be send as `inline`. For example


```
```none
{
"attrs": {
"env1": "val1",
Expand All @@ -129,7 +129,7 @@ Third format is a `raw` message. You can specify it by using
`--log-opt splunk-format=raw`. Attributes (environment variables and labels) and
tag will be prefixed to the message. For example

```
```none
MyImage/MyContainer env1=val1 label1=label1 my message
MyImage/MyContainer env1=val1 label1=label1 {"foo": "bar"}
```
Expand Down
4 changes: 4 additions & 0 deletions engine/swarm/admin_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,19 @@ 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
{% raw %}
docker node inspect manager1 --format "{{ .ManagerStatus.Reachability }}"
reachable
{% endraw %}
```

To query the status of the node as a worker that accept tasks:

```bash
{% raw %}
docker node inspect manager1 --format "{{ .Status.State }}"
ready
{% endraw %}
```

From those commands, we can see that `manager1` is both at the status
Expand Down
6 changes: 6 additions & 0 deletions engine/tutorials/networkingcontainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ Launch a container running a PostgreSQL database and pass it the `--net=my-bridg
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"}}
Expand All @@ -155,14 +157,18 @@ Now, go ahead and start your by now familiar web application. This time don't sp

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

Expand Down
2 changes: 2 additions & 0 deletions engine/userguide/networking/default_network/dockerlinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ example as:

Next, inspect your linked containers with `docker inspect`:

{% raw %}
$ docker inspect -f "{{ .HostConfig.Links }}" web

[/db:/web/db]
{% endraw %}

You can see that the `web` container is now linked to the `db` container
`web/db`. Which allows it to access information about the `db` container.
Expand Down

0 comments on commit 5591272

Please sign in to comment.