Let’s make your Docker Image better than 90% of existing ones

Docker Labels to the rescue!

LABEL <label_name>="<label_value>"
FROM openjdk:jre-alpine
LABEL maintainer="dev@someproject.org"
LABEL build_date="2017-09-05"
COPY tool.tar.gz /mnt
WORKDIR /mnt
RUN tar zxvf /mnt/tool.tar.gz
CMD ["/mnt/tool/tool.sh"]

What should I label my Image with?

  • build-date
  • name
  • description
  • url
  • vcs-ref
  • docker.cmd
LABEL org.label-schema.build-date="2017-08-28T09:24:41Z"
date -u +'%Y-%m-%dT%H:%M:%SZ'
FROM openjdk:jre-alpine
LABEL maintainer="dev@someproject.org"
ARG BUILD_DATELABEL org.label-schema.build-date=$BUILD_DATECOPY tool.tar.gz /mnt
WORKDIR /mnt
RUN tar zxvf /mnt/tool.tar.gz
CMD ["/mnt/tool/tool.sh"]
docker build --no-cache=true --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t mytool:latest .

Label your Images so that they can stand on their own.

FROM openjdk:jre-alpine
LABEL maintainer="tryballerina@gmail.com"

# Ballerina runtime distribution filename.
ARG BALLERINA_DIST
ARG BUILD_DATE
ARG VCS_REF
ARG BUILD_VERSION

# Labels.
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="ballerinalang/ballerina"
LABEL org.label-schema.description="Ballerina language runtime"
LABEL org.label-schema.url="http://ballerinalang.org/"
LABEL org.label-schema.vcs-url="https://github.com/ballerinalang/container-support"
LABEL org.label-schema.vcs-ref=$VCS_REF
LABEL org.label-schema.vendor="WSO2"
LABEL org.label-schema.version=$BUILD_VERSION
LABEL org.label-schema.docker.cmd="docker run -v ~/ballerina/packages:/ballerina/files -p 9090:9090 -d ballerinalang/ballerina"
Nice little visualization of the layers!

--

--

--

developer, #cloud enthusiast, #apacheStratos committer, expect #linux, #containers, #kubernetes, #microservices, and #devops in general

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Hey DevOps, you’re killing my job!

Evolution and Recent Trends in Web Development

Jenkins Pipeline with GitLab for Java Projects

Builder and Composite design patterns C#

3D Crystal NFTs Ⅲ Giveaway Events

Unity is strength, the community is the basis of the success for every project

Assistant & … Pizza 🍕 — Dialogflow — Part 2

Building DApps on Casper Using BSN

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
chamila de alwis

chamila de alwis

developer, #cloud enthusiast, #apacheStratos committer, expect #linux, #containers, #kubernetes, #microservices, and #devops in general

More from Medium

How to create a docker to run TensorFlow

An example of Docker File

colors-accessibility — small package to help making colors more accessible

How to Publish Events to Azure EventHub — code snippets here

From Excel Sheet to Postman Request