docs: userguide: labels-custom-metadsata.md: update syntax for emtpy value labels

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: aada8d81177de793db38845ff3a26949436e1ed6
Component: engine
This commit is contained in:
Antonio Murdaca
2015-12-16 13:43:41 +01:00
parent 51d333deab
commit 295cafe7dd
2 changed files with 16 additions and 8 deletions

View File

@ -95,14 +95,17 @@ nested properties, the tool itself needs to implement this functionality.
To add labels to an image, use the `LABEL` instruction in your Dockerfile:
LABEL [<namespace>.]<key>[=<value>] ...
LABEL [<namespace>.]<key>=<value> ...
The `LABEL` instruction adds a label to your image, optionally with a value.
The `LABEL` instruction adds a label to your image. A `LABEL` consists of a `<key>`
and a `<value>`.
Use an empty string for labels that don't have a `<value>`,
Use surrounding quotes or backslashes for labels that contain
white space characters in the `<value>`:
LABEL vendor=ACME\ Incorporated
LABEL com.example.version.is-beta
LABEL com.example.version.is-beta=
LABEL com.example.version.is-production=""
LABEL com.example.version="0.0.1-beta"
LABEL com.example.release-date="2015-02-12"
@ -114,7 +117,8 @@ in a single instruction:
Long lines can be split up by using a backslash (`\`) as continuation marker:
LABEL vendor=ACME\ Incorporated \
com.example.is-beta \
com.example.is-beta= \
com.example.is-production="" \
com.example.version="0.0.1-beta" \
com.example.release-date="2015-02-12"
@ -130,6 +134,7 @@ You can view the labels via the `docker inspect` command:
"Labels": {
"vendor": "ACME Incorporated",
"com.example.is-beta": "",
"com.example.is-production": "",
"com.example.version": "0.0.1-beta",
"com.example.release-date": "2015-02-12"
}
@ -138,7 +143,7 @@ You can view the labels via the `docker inspect` command:
# Inspect labels on container
$ docker inspect -f "{{json .Config.Labels }}" 4fa6e0f0c678
{"Vendor":"ACME Incorporated","com.example.is-beta":"","com.example.version":"0.0.1-beta","com.example.release-date":"2015-02-12"}
{"Vendor":"ACME Incorporated","com.example.is-beta":"", "com.example.is-production":"", "com.example.version":"0.0.1-beta","com.example.release-date":"2015-02-12"}
# Inspect labels on images
$ docker inspect -f "{{json .ContainerConfig.Labels }}" myimage