Docker Metadata and Labels

Docker Metadata and Labels 1
Docker Metadata and Labels 2

1.Labels to the containers

we can add one or multiple labels to the containers with command docker run user id to the container

docker run -l user=5624 -d ubuntu

2.External file

we have to add multiple labels from a file, here the file needs a label on each line, this will be attached to the running container

echo 'user=123461' >> labels && echo 'role=cache' >> labels

The –label-file=<filename> option will create a label for each line in the file

docker run --label-file=labels -d redis

3.Labeling for images

we should use the build command while building an image

LABEL vendor=codeskulls

for multiple labels

LABEL vendor=codeskulls \ com.codeskulls.version=0.88.54 \ \

4.Filtering  by labels

docker images --filter "label=vendor=codeskulls"

Default image
Vishal Devxo
Vishal Devxo is a DevOps engineer and a Backend developer, he spends all his time for creating good tutorials with better visuals and blogging, developed some projects based on Python-Django, some hacking modules and scripts in python