From aada8d81177de793db38845ff3a26949436e1ed6 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Wed, 16 Dec 2015 13:43:41 +0100 Subject: [PATCH] docs: userguide: labels-custom-metadsata.md: update syntax for emtpy value labels Signed-off-by: Antonio Murdaca --- docs/userguide/labels-custom-metadata.md | 15 ++++++++++----- man/Dockerfile.5.md | 9 ++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/userguide/labels-custom-metadata.md b/docs/userguide/labels-custom-metadata.md index e4ac7c4cdf..1a57eafe8d 100644 --- a/docs/userguide/labels-custom-metadata.md +++ b/docs/userguide/labels-custom-metadata.md @@ -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 [.][=] ... + LABEL [.]= ... -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 `` +and a ``. +Use an empty string for labels that don't have a ``, Use surrounding quotes or backslashes for labels that contain white space characters in the ``: 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 diff --git a/man/Dockerfile.5.md b/man/Dockerfile.5.md index c5e5bea518..7d56bda0fa 100644 --- a/man/Dockerfile.5.md +++ b/man/Dockerfile.5.md @@ -156,20 +156,23 @@ A Dockerfile is similar to a Makefile. the image. **LABEL** - -- `LABEL [=] [[=] ...]`or + -- `LABEL = [= ...]`or ``` LABEL [ ] LABEL [ ] ... ``` 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