LABEL

The LABEL command can be used to add extra information to the image. This information can be anything from a version number to a description. It's also recommended that you limit the number of labels you use. A good label structure will help others who have to use our image later on. However, using too many labels can cause the image to become inefficient as well--I would recommend using the label schema detailed at http://label-schema.org/. You can view the containers' labels with the docker inspect command:

$ docker image inspect <IMAGE_ID>

Alternatively, you can use the following to filter just the labels:

$ docker image inspect -f {{.Config.Labels}} <IMAGE_ID>

For our example, we add two labels: one to identify who maintains the Dockerfile by adding maintainer="Russ McKendrick <[email protected]>" and another, a description, description="This example Dockerfile installs NGINX.".

Generally though, it is better to define your labels when you create a container from your image rather than at build time, so it is best to keep labels down to just metadata about the image and nothing else.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset