Docker.github.io: Inconsistent example for replacing MAINTAINER with LABEL

Created on 16 Feb 2017  路  8Comments  路  Source: docker/docker.github.io

Problem description

The documentation for the deprecated MAINTAINER says that we should replace MAINTAINER with LABEL.
But the example is inconsistent with the documentation for LABEL.

The example says:

LABEL maintainer "[email protected]"

But shouldn't it be:

LABEL maintainer="[email protected]"

Problem location

areEngine

Most helpful comment

I built an image again using Dockfile with the following label defined:

LABEL maintainer "[email protected]" description "test adding labels in Dockfile"

The image is also successfully built. But the output of docker inspect is as follows.
4

It shows that the maintainer info and the description info are mixed up.

So I think if only one item is included in LABEL, it is OK to define LABEL without "=" (that is, in "LABEL key value" format, such as LABEL maintainer "[email protected]" ); but if there are two or more items, "=" is necessary.

To avoid misleading, it is better to add "=" between key and value.

All 8 comments

dibs

I tested building 4 images using Dockfiles that only differ in "LABEL". The "LABEL" filelds are respectively defined in the Dockerfiles as follows:

All images are successfully built. Then, I checked the image info by running docker inspect <image ID>. The output shows that the images all have the same correct maintainer filed as I specified. Here are some screenshots referring to the building process and the output.

7
8
8-2

I built an image again using Dockfile with the following label defined:

LABEL maintainer "[email protected]" description "test adding labels in Dockfile"

The image is also successfully built. But the output of docker inspect is as follows.
4

It shows that the maintainer info and the description info are mixed up.

So I think if only one item is included in LABEL, it is OK to define LABEL without "=" (that is, in "LABEL key value" format, such as LABEL maintainer "[email protected]" ); but if there are two or more items, "=" is necessary.

To avoid misleading, it is better to add "=" between key and value.

Add "=" via #32682.

@thaJeztah WDYT? I don't think the things in the Dockerfile usually have the equals signs. Are labels different?

@mstanleyjones I think LABEL, ENV (and others) supports both notation (with and without an equal sign). But without an equal sign, it can get tricky 馃懠

Review happening upstream. Going ahead and counting this.

Closing as the work has shifted to moby/moby. Thanks @scjane!

Was this page helpful?
0 / 5 - 0 ratings