Docker PT 3

Docker labels

Docker labels are a way to organize images, annotate container relationships, add licensing information, and more.

They can be used on the following Docker objects:

Docker labels consist of key value pairs in the following format:

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

where LABEL is an instruction in the Dockerfile and will add the metadata to the image.

Labels can similarly be added to containers using the –label flag or loading multiple labels from a file with the –label-file command like:

docker run --label-file ./labels ubuntu bash