Docker Metadata and Labels

Docker-Metadata-and-Labels.png

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 below option will create a label for each line in the file

–label-file=<filename>
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 \ com.codeskulls.build-date=2018-07-01T10:47:56Z \

4.Filtering by labels

docker images --filter "label=vendor=codeskulls"
Last updated on by vishal devxo