ScanSkill

LABEL

LABEL instruction is used to add metadata to the docker image. It’s a key-value pair. You need to use quotes and backslashes to include spaces within a LABEL.

Syntax

LABEL <key>=<value> <key>=<value> <key>=<value> ...

Examples

LABEL "company.cloudyfox.com"="Information Technology"
LABEL company.cloudyfox.com="private"
LABEL version="1.0"
LABEL description="In this way you can use \\
level values in multiple lines."

Also, you can use multi-label on a single line.

LABEL multi.label1="latest" multi.label2="first" other="value3"

OR

LABEL multi.label1="latest" \\
			multi.label2="first" \\
			other="value"

And you can view an image’s labels, with the following command:

$ docker image inspect --format='' myImage
{
  "company.cloudyfox.com": "Information Technology",
  "company.cloudyfox.com": "foo",
  "version": "1.0",
  "description": "In this way you can use level values in multiple lines.",
  "multi.label1": "latest",
  "multi.label2": "fisrst",
  "other": "value"
}