New in Dockbit: Powered up Docker Provider

Ahmed ElGamil
Dockbit
Published in
3 min readNov 28, 2017

--

The latest and greatest Docker things to improve your Dockbit pipeline

One of the essentials in any DevOps toolbox nowadays is a Docker builder. Ever since we released the Docker Provider on Dockbit a few months ago, we’ve had superb feedback on how we can improve the builder for your workflows. Recently, we pushed out support for Docker’s Build-time arguments. Today, we’d like to introduce some shiny new additions.

Upgraded Docker Daemon

We strive to use the latest stable version of the CE (Community Edition) of Docker. At the time of writing, 17.06 is the latest and it comes with a bunch of great features such as multi-stage builds. Whenever you add a Docker stage to your Dockbit pipeline, the image building process starts in an isolated VM supported by Docker daemon 17.06.

Multi-tag support for images

Image tags are a great way to give human-friendly names to your Docker images and differentiate between them. Teams can use it for naming images after their application version, commit SHA or even the deployment environment. Consider the scenario where you’re building the latest version of your app, here’s how tagging the same image with multiple tags can come in handy:

In this example, we’re pushing a tag of master as well as updating the latest tag of the Docker image to point to the same image.

In order to use multiple tags in Dockbit, simply separate the tags with a comma , as a delimiter.

Multi-stage builds

Along with the introduction of version 17.06 of the Docker daemon, comes multi-stage builds.

One of the most challenging things about building images is keeping the image size down. Each instruction in the Dockerfile adds a layer to the image, and you need to remember to clean up any artifacts you don’t need before moving on to the next layer.

With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.

We wrote a comparison earlier on how we Dockerize hacher (A simple CLI tool to cache project artifacts) using both methods. Check it out here.

Bonus tip: Setting tags dynamically

Naturally, every deployment you trigger on Dockbit has unique metadata. Be it the deployment number, Git commit SHA, Git reference, etc. Naming your Docker image tags after one (or a combination) of these metadata can make life a lot easier when tracking software deployments.

In order to do so, you can simply supply any of Dockbit’s built-in variables as the image tag in the Docker stage configuration. Here’s an example setting an image tag after Git reference (Git tag or branch name):

dockbit/hacher:${DOCKBIT_DEPLOYMENT_REF}

Interested in implementing those exciting new things in your pipeline? Don’t forget to check the documentation for the Docker Provider.

Dockbit turns your complex software deployments into simple, manageable workflows. Sign up now to get your 2 pipelines for free, connect dozens of services together, and kick-off deployments with a single Slack command. 🚀

--

--

Co-Founder & Chief Architect @dockbit, DevOps, DadOps, Uplifting delivery pipelines for software teams to ship better!