mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
docs: userguide: labels-custom-metadsata.md: update syntax for emtpy value labels
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
bb2c92355c
commit
aada8d8117
2 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -156,20 +156,23 @@ A Dockerfile is similar to a Makefile.
|
|||
the image.
|
||||
|
||||
**LABEL**
|
||||
-- `LABEL <key>[=<value>] [<key>[=<value>] ...]`or
|
||||
-- `LABEL <key>=<value> [<key>=<value> ...]`or
|
||||
```
|
||||
LABEL <key>[ <value>]
|
||||
LABEL <key>[ <value>]
|
||||
...
|
||||
```
|
||||
The **LABEL** instruction adds metadata to an image. A **LABEL** is a
|
||||
key-value pair. To include spaces within a **LABEL** value, use quotes and
|
||||
key-value pair. To specify a **LABEL** without a value, simply use an empty
|
||||
string. To include spaces within a **LABEL** value, use quotes and
|
||||
backslashes as you would in command-line parsing.
|
||||
|
||||
```
|
||||
LABEL com.example.vendor="ACME Incorporated"
|
||||
or
|
||||
LABEL com.example.vendor "ACME Incorporated"
|
||||
LABEL com.example.vendor.is-beta ""
|
||||
LABEL com.example.vendor.is-beta=
|
||||
LABEL com.example.vendor.is-beta=""
|
||||
```
|
||||
|
||||
An image can have more than one label. To specify multiple labels, separate
|
||||
|
|
Loading…
Reference in a new issue