Docker containers, Bamboo, and winning at continuous delivery

Docker containers, Bamboo, and winning at continuous delivery

Trends like continuous delivery and microservice-based architectures are the reason SaaS darlings like Netflix and Etsy ship improvements to their customers 20 or more times a day. Talk about efficiency! And with the help of tools like Bamboo and Docker, your team can get there, too (even if you’re not shipping a SaaS product). Read on to learn how your team can use Docker and Bamboo to speed up an existing delivery pipeline, or revolutionize your development and deploy practices from the ground up.

Continuous delivery and containerized, microservice-based architectures are the reason SaaS darlings like Netflix and Etsy ship improvements to their customers 20+ times a day. With the help of Bamboo and Docker – and this 2-part blog series – your team can get there, too.

In this post (part 1), I’ll show you how to use Docker and Bamboo to create the build agents that power your continuous delivery pipeline. Think of it as a shortcut for scaling builds, tests, and deploys up or down. I’ll also cover containerizing build artifacts for easy sharing. Then in part 2, we’ll talk about using Docker and Bamboo to build your web app.

Btw, if you want a tutorial on getting started with Docker, take a quick detour to this post from Docker fan-boy and Atlassian developer advocate Nicola Paolucci. He’ll show you the basics of setting up Docker on your local machine and using it to build a web app from the command line.

Understanding the components

First, let’s define the various components we’ll use to create build agents with Docker.

What is a build agent?

A build agents are the virtual machines inside Bamboo that execute the steps in your build – they serve the same purpose build slaves in Jenkins. To successfully execute builds, each agent must be configured with whatever capabilities your build requires. For example, if git checkout is one of the steps, your build agent must have Git installed.

What is the Docker engine?

“Docker engine” is a commonly used term that simply refers to your installation of Docker.

What is a Docker image?

Docker images are essentially blueprints for building and running an instance of an application. When creating a Docker image, you define everything needed to run an application or service: operating system, database, binaries, etc. When you need to scale up, you use the image to fire up new nodes – or in Docker-speak, “containers”.

What is a Docker container?

Containers are instances of an image. By containerizing your application, you guarantee it’ll run the same in every environment, every time you run it.

What is a Docker agent?

When you run a Bamboo build agent inside a Docker container, we call that a “Docker agent”.

What are Docker tasks?

“Task” a Bamboo-specific term, representing a step in your build process such as checking out code, executing Junit, sending binaries to a host, etc. Docker tasks are the three Docker-flavored things Bamboo does out of the box:

Docker tasks will come into play when we talk about using Bamboo to containerize builds of your application.

Creating build agents with Docker

Using Docker agents has a couple advantages over configuring build agents individually:

We have two build agent images on Docker hub: a base agent, and a Java agent. Both can be used as-is, or customized to suit your needs. Once you have Docker installed, pull down these images and use them to create build agents in Bamboo – refer to the Bamboo docs for more details on getting started.

Like other build agents running on any other remote server, Docker agents appear under the Online remote agents tab once they’re up and running. At that point, they’re at your disposal to run builds, tests, and deployments.

Using Bamboo to Dockerize your application

“But wait: there’s more…”

You can also use Bamboo to containerize your build artifacts. Just add the Docker task to your build set-up in Bamboo, select the “Build a Docker image” command, and customize it using the options available.

Let’s review a typical use case.

I have a build that generates an artifact. I also have teams around me who need that same artifact. And let’s say they don’t all run the same version of Java, or don’t already pull in all the dependencies needed to use my artifact. No problem.

I can use Bamboo to package that artifact and it’s dependencies in a container using the “Build a Docker image” command. I add a task to run and test the artifact to make sure I’m giving those other teams something usable. Finally, I add another instance of the Docker task, but select the “Push a Docker image to a Docker registry” command this time.

 

Thus, my downstream teams can grab that container and incorporate it into their CD pipeline, or just run it. Either way, containerizing your build artifacts saves them a ton of time (and headaches).

 

Using Docker and Bamboo together helps you scale your continuous delivery pipeline through easy, reliable build agent creation, and easy artifact sharing. If you’re not a Bamboo user yet, start a free trial and see for yourself what it can do. And don’t forget to pull down those agent images.

Happy building!

Grab build agent images from the Docker hub

Exit mobile version