Jelajahi Sumber

Update builder.md

Single value labels do not work in 1.6 and multi-label instructions only work when separated by non-EOL whitespace.
I also added an example snip from the inspect output with the labels that are included in this guide.

Signed-off-by: Jeff Nickoloff <jeff@allingeek.com>
Jeff Nickoloff 10 tahun lalu
induk
melakukan
89df65be5d
1 mengubah file dengan 13 tambahan dan 2 penghapusan
  1. 13 2
      docs/sources/reference/builder.md

+ 13 - 2
docs/sources/reference/builder.md

@@ -373,9 +373,8 @@ blackslashes as you would in command-line parsing.
     LABEL "com.example.vendor"="ACME Incorporated"
     LABEL "com.example.vendor"="ACME Incorporated"
 
 
 An image can have more than one label. To specify multiple labels, separate each
 An image can have more than one label. To specify multiple labels, separate each
-key-value pair by an EOL.
+key-value pair with whitespace.
 
 
-    LABEL com.example.label-without-value
     LABEL com.example.label-with-value="foo"
     LABEL com.example.label-with-value="foo"
     LABEL version="1.0"
     LABEL version="1.0"
     LABEL description="This text illustrates \
     LABEL description="This text illustrates \
@@ -385,6 +384,8 @@ Docker recommends combining labels in a single `LABEL` instruction where
 possible. Each `LABEL` instruction produces a new layer which can result in an
 possible. Each `LABEL` instruction produces a new layer which can result in an
 inefficient image if you use many labels. This example results in four image
 inefficient image if you use many labels. This example results in four image
 layers. 
 layers. 
+
+    LABEL multi.label1="value1" multi.label2="value2" other="value3"
     
     
 Labels are additive including `LABEL`s in `FROM` images. As the system
 Labels are additive including `LABEL`s in `FROM` images. As the system
 encounters and then applies a new label, new `key`s override any previous labels
 encounters and then applies a new label, new `key`s override any previous labels
@@ -392,6 +393,16 @@ with identical keys.
 
 
 To view an image's labels, use the `docker inspect` command.
 To view an image's labels, use the `docker inspect` command.
 
 
+    "Labels": {
+        "com.example.vendor": "ACME Incorporated"
+        "com.example.label-with-value": "foo",
+        "version": "1.0",
+        "description": "This text illustrates that label-values can span multiple lines.",
+        "multi.label1": "value1",
+        "multi.label2": "value2",
+        "other": "value3"
+    },
+
 ## EXPOSE
 ## EXPOSE
 
 
     EXPOSE <port> [<port>...]
     EXPOSE <port> [<port>...]