Docker Runner is a Bamboo feature that allows you to run builds and deployments in a Docker container. This isolates the build process from the rest of the environment it runs in. This increases the security of your environments by providing more strict control over resources the continuous integration (CI) process has access to. The isolation also helps with the reliability of your CI by making sure that environment it runs in can be reliably recreated each time you run your builds. This increases the reliability of your builds by minimizing the influence of external applications on the build environment and allowing a finer control of resources dedicated to the build. Moreover it allows to easily reproduce the environment at a later time and on a different environment.
Docker Runner operates at the level of Bamboo jobs. A job is the unit of distribution of work per Bamboo build agents and it is itself made of a set of tasks that run sequentially. When a job is distributed with Docker Runner to a remote / local agent a Docker container is created on the build agent that picks up the job. Then the job runs all the tasks that it is comprised of in a sequential manner inside the container and finally Bamboo copies the build results of the job and cleans up. Bamboo transparently creates, manages and cleans up the Docker container when the build has finished but there are some configuration settings that can influence this process which are explained below.
If you want to user Docker images in your Bamboo builds at a different level than jobs, you can do that with Docker tasks. See Configuring the Docker task in Bamboo.
- Make sure you have Docker installed. We advise to use the most recent version. Bamboo provides support for Docker for Mac, and Docker for Ubuntu in version 17 and later.
Define a Docker capability in Bamboo. See Defining a new Docker capability
Enabling Docker Runner
Runner can be enabled for jobs and deployment environments when:
Enabling Docker for a job or a deployment environment disables their standard requirements which come from tasks and replaces them with a single requirement for Docker.
Custom requirements, manually configured by users, will not be erased, and will still be used for agent matching.
To enable Docker Runner, in the Isolate build section, just choose to run the job in a Docker container and provide the Docker image.
When editing a job or a deployment environment, you can also specify which directories from Bamboo agent should be mounted as additional volumes to the Docker container.
Docker Runner is also fully supported with Bamboo Specs. See our Bamboo Specs reference guide.
For more information about Bamboo and Docker integration, see Getting started with Docker and Bamboo