Browse code

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

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Antonio Murdaca authored on 2015/12/16 21:43:41
Showing 2 changed files
... ...
@@ -95,14 +95,17 @@ nested properties, the tool itself needs to implement this functionality.
95 95
 To add labels to an image, use the `LABEL` instruction in your Dockerfile:
96 96
 
97 97
 
98
-    LABEL [<namespace>.]<key>[=<value>] ...
98
+    LABEL [<namespace>.]<key>=<value> ...
99 99
 
100
-The `LABEL` instruction adds a label to your image, optionally with a value.
100
+The `LABEL` instruction adds a label to your image. A `LABEL` consists of a `<key>`
101
+and a `<value>`.
102
+Use an empty string for labels  that don't have a `<value>`,
101 103
 Use surrounding quotes or backslashes for labels that contain
102 104
 white space characters in the `<value>`:
103 105
 
104 106
     LABEL vendor=ACME\ Incorporated
105
-    LABEL com.example.version.is-beta
107
+    LABEL com.example.version.is-beta=
108
+    LABEL com.example.version.is-production=""
106 109
     LABEL com.example.version="0.0.1-beta"
107 110
     LABEL com.example.release-date="2015-02-12"
108 111
 
... ...
@@ -114,7 +117,8 @@ in a single instruction:
114 114
 Long lines can be split up by using a backslash (`\`) as continuation marker:
115 115
 
116 116
     LABEL vendor=ACME\ Incorporated \
117
-          com.example.is-beta \
117
+          com.example.is-beta= \
118
+          com.example.is-production="" \
118 119
           com.example.version="0.0.1-beta" \
119 120
           com.example.release-date="2015-02-12"
120 121
 
... ...
@@ -130,6 +134,7 @@ You can view the labels via the `docker inspect` command:
130 130
     "Labels": {
131 131
         "vendor": "ACME Incorporated",
132 132
         "com.example.is-beta": "",
133
+        "com.example.is-production": "",
133 134
         "com.example.version": "0.0.1-beta",
134 135
         "com.example.release-date": "2015-02-12"
135 136
     }
... ...
@@ -138,7 +143,7 @@ You can view the labels via the `docker inspect` command:
138 138
     # Inspect labels on container
139 139
     $ docker inspect -f "{{json .Config.Labels }}" 4fa6e0f0c678
140 140
 
141
-    {"Vendor":"ACME Incorporated","com.example.is-beta":"","com.example.version":"0.0.1-beta","com.example.release-date":"2015-02-12"}
141
+    {"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"}
142 142
 
143 143
     # Inspect labels on images
144 144
     $ docker inspect -f "{{json .ContainerConfig.Labels }}" myimage
... ...
@@ -156,20 +156,23 @@ A Dockerfile is similar to a Makefile.
156 156
   the image.
157 157
 
158 158
 **LABEL**
159
-  -- `LABEL <key>[=<value>] [<key>[=<value>] ...]`or 
159
+  -- `LABEL <key>=<value> [<key>=<value> ...]`or 
160 160
   ```
161 161
   LABEL <key>[ <value>]
162 162
   LABEL <key>[ <value>]
163 163
   ...
164 164
   ```
165 165
   The **LABEL** instruction adds metadata to an image. A **LABEL** is a
166
-  key-value pair. To include spaces within a **LABEL** value, use quotes and
166
+  key-value pair. To specify a **LABEL** without a value, simply use an empty
167
+  string. To include spaces within a **LABEL** value, use quotes and
167 168
   backslashes as you would in command-line parsing.
168 169
 
169 170
   ```
170 171
   LABEL com.example.vendor="ACME Incorporated"
171
-  or
172 172
   LABEL com.example.vendor "ACME Incorporated"
173
+  LABEL com.example.vendor.is-beta ""
174
+  LABEL com.example.vendor.is-beta=
175
+  LABEL com.example.vendor.is-beta=""
173 176
   ```
174 177
 
175 178
   An image can have more than one label. To specify multiple labels, separate