New for the Image-Conscious Container: Label-Schema.org

Anne Currie
Microscaling Systems
3 min readSep 9, 2016

--

One of the many excellent features of Docker containers is they’re easy to create, we can rapidly build hundreds or thousands of images and instances.

But that can also be a problem because thousands of unlabelled containers are a whole pile of black boxes. For example, we don’t know what code or base images the container is built from, what license it’s under or what the developer intended to do with it. To find all that out we need developers to provide image metadata.

The Problem

The good news is since way back in Docker 1.6 we have had a defined, flexible way for developers to specify metadata for an image using dockerfile labels. But there are still two problems

  • Very few images on DockerHub currently have labels at all (<10% we reckon).
  • There’s not much consistency in how labels are used.

That’s a shame because widely used and consistent labels could kick off a whole range of useful tools.

So, Label-schema.org

We’re big fans of containers and of being organised so we helped create the label-schema community project to help promote label use and consistency. label-schema isn’t a standard, we’re just documenting good existing label use so everyone can take a look and choose to adopt a consistent approach.

RC1

The label-schema RC1 has launched this Friday at ContainerCamp in London. It’s a minimal suggestion of what build-time labels a container image should wear, based on recommendations from folk like Mesosphere, Puppet, RedHat, MicroBadger, ContainerSolutions and Google. Here’s an example of a formatted LABEL for our microscaling dockerfile. Note we’ve added multiple labels in a single line for compactness (each LABEL parameter generates a new image layer).

FROM alpine:3.3
MAINTAINER Ross Fairbanks "ross@microscaling.com"

ENV BUILD_PACKAGES ca-certificates

RUN apk update && \
apk upgrade && \
apk add $BUILD_PACKAGES && \
rm -rf /var/cache/apk/*

# Add binary and Dockerfile
COPY microscaling Dockerfile /

RUN chmod +x /microscaling

# Metadata params
ARG VERSION
ARG VCS_URL
ARG VCS_REF
ARG BUILD_DATE

# Metadata
LABEL org.label-schema.vendor="Microscaling Systems" \
org.label-schema.url="https://microscaling.com" \
org.label-schema.name="Microscaling Engine" \
org.label-schema.description="Optimal resource util" \
org.label-schema.version="1.2.3" \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.schema-version="1.0"

You can read more background about why we chose that those particular labels at the bottom of this page.

Making Labels Work for You

Of course, once you have the basics in place you can use whatever build-time labels you choose to achieve your own look for your containers.

Please let us know at Label-Schema.org about your interesting label use cases and we’ll point folk at them.

With the release candidate we’re seeking as much input as possible. We have a mailing list you can file issues or make pull requests against the label-schema.org GitHub repository.

Please hit the Recommend button below if you found this article interesting or helpful, so that others might be more likely to find it.

Check out MicroBadger to explore image metadata, and follow Microscaling Systems on Twitter.

--

--

Anne Currie
Microscaling Systems

SciFi author interested in tech, engineering, science, art, SF, economics, psychology, startups. Chaotic evil.