Allow specification of Label Name/Value pairs in image json content

Save "LABEL" field in Dockerfile into image content.

This will allow a user to save user data into an image, which
can later be retrieved using:

docker inspect IMAGEID

I have copied this from the "Comment" handling in docker images.

We want to be able to add Name/Value data to an image to describe the image,
and then be able to use other tools to look at this data, to be able to do
security checks based on this data.

We are thinking about adding version names,
Perhaps listing the content of the dockerfile.
Descriptions of where the code came from etc.

This LABEL field should also be allowed to be specified in the
docker import --change LABEL:Name=Value
docker commit --change LABEL:Name=Value

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
This commit is contained in:
Dan Walsh
2015-02-17 07:20:06 -08:00
committed by Darren Shepherd
parent 6374c12fbb
commit cdfdfbfb62
14 changed files with 113 additions and 8 deletions

View File

@@ -71,6 +71,13 @@ This endpoint now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`.
### What's new
**New!**
Build now has support for `LABEL` command which can be used to add user data
to an image. For example you could add data describing the content of an image.
`LABEL "Vendor"="ACME Incorporated"`
**New!**
`POST /containers/(id)/attach` and `POST /exec/(id)/start`
**New!**

View File

@@ -129,6 +129,11 @@ Create a container
],
"Entrypoint": "",
"Image": "ubuntu",
"Labels": {
"Vendor": "Acme",
"License": "GPL",
"Version": "1.0"
},
"Volumes": {
"/tmp": {}
},
@@ -1169,6 +1174,7 @@ Return low-level information on the image `name`
"Cmd": ["/bin/bash"],
"Dns": null,
"Image": "ubuntu",
"Labels": null,
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""

View File

@@ -328,6 +328,17 @@ default specified in `CMD`.
> the result; `CMD` does not execute anything at build time, but specifies
> the intended command for the image.
## LABEL
LABEL <key>=<value> <key>=<value> <key>=<value> ...
--The `LABEL` instruction allows you to describe the image your `Dockerfile`
is building. `LABEL` is specified as name value pairs. This data can
be retrieved using the `docker inspect` command
LABEL Description="This image is used to start the foobar executable" Vendor="ACME Products"
LABEL Version="1.0"
## EXPOSE
EXPOSE <port> [<port>...]
@@ -907,6 +918,7 @@ For example you might add something like this:
FROM ubuntu
MAINTAINER Victor Vieux <victor@docker.com>
LABEL Description="This image is used to start the foobar executable" Vendor="ACME Products" Version="1.0"
RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server
# Firefox over VNC