Tagfish, a CLI tool to interact with Docker registries

logo

I joined REA's Consumer & Brand Delivery Engineering team 8 months ago, it's been a blast and I love working on the tech we use. We extensively use Docker, AWS, and Ruby to produce internal tools such as shipper that other teams use to ship their containerized applications.

We host our own Docker Registry, and we maintain a set of base images, such as ubuntu-ruby2.2 which is an image based on the official Ubuntu, with Ruby 2.2 and a few other dependencies baked in. We want the teams at REA to use those images, because we control how they are built and we include libraries and dependencies widely used in the company.

With Docker, the tag latest is a moving target and refers to the latest build of an image. This is not ideal when building an artifact because we want deterministic outputs. If you use the latest images available, and your CI job fails to run the tests suite, how do you know what exactly has changed? This is why we version our images using explicit tags, such as v1, v2, or a timestamp like 201512140925.

Then you would start your Dockerfile with something like:

FROM ubuntu-ruby2.2:201512140925

This way the same image is always used when building your application Docker image.

But what happens when we release a new version of our base image(s)? Well, we have to tell everybody using them to update their Dockerfiles, and they have to do so manually ...that's not great.

And when updating my Dockerfile, how do I find the newest explicit tag (not latest) of an image? Our Docker Registry does not have a web UI like hub.docker.com does, and even if it did, clicking and typing in the UI to find a tag is not very efficient. It would be nice to have a command line tool to do just that...

Eric Raymond says that "Every good work of software starts by scratching a developer's personal itch", so we made tagfish.

Tagfish is a CLI tool, written in Ruby, packaged as a gem and a Docker image. Tagfish retrieves the latest explicit tag of a given repository ... and more! You can use it to list all the tags of a repository, to update your Dockerfiles directly, or even to search for a repository. It works against Docker Registry API v1, Docker Distribution API v2, and supports authentication.

Find out more at https://github.com/realestate-com-au/tagfish