Getting started with Docker and Bamboo
Manage and run your Bamboo remote agents using Docker!
A Bamboo server can use one or more remote build agents (up to 100 depending on your license). Remote agents execute jobs from your build plan. Because jobs can have different requirements, it is useful to have agents with different capabilities.
Docker is a great way to manage your remote agents, and provides:
- Ease of use – you can automate or script the creation and maintenance of your remote agents.
- Very quick duplication and distribution of changes to remote agents.
- The ability to run multiple remote agents on the same host without conflicting requirements.
Read Configuring the Docker task in Bamboo to see how you can build Docker images, run Docker containers as part of your Bamboo build, and push a Docker image to a Docker registry.
Atlassian has published two images to the Docker Hub at https://hub.docker.com/u/atlassian/.
|atlassian/bamboo-java-agent||Suitable for java stack development.|
Suitable for deep customization.
You can modify these images to suit your own requirements.
Note that the Docker images do not include a Bamboo server. Download and install Bamboo separately before continuing – see Getting started with Bamboo.
For a new Bamboo installation there will not be any remote agents yet. When you run a remote agent (see below), it will connect to the Bamboo server and will be ready to execute jobs from your build plans.
Ensure your Bamboo server is running, then go to Administration > Agents to see your remote agent once it is running.
The following commands need to be run with
sudo because Docker needs to run as root. You may need to replace
docker.io (depending on your installation) – see http://docker.io.
Pull the remote build agent from the Docker Hub Repository:
sudo docker pull atlassian/bamboo-java-agent
Once downloaded, run your agent with the following command:
sudo docker run -e HOME=/root/ -e BAMBOO_SERVER=http://hostname:port/bamboo -i -t atlassian/bamboo-java-agent:latest
hostname:port with your Bamboo server's name and port (typically 8085).
localhost as the server address because for Docker,
localhost is in the Docker container, not the host machine.
Go back to Administration > Agents (or refresh that page) and notice that your remote agent has registered itself.
The two Bamboo agent images are based on our own atlassian/ubuntu-minimal image, which is built using the Docker 'contrib' script and 'debootstrap'.
To customize an image, run it in a container. Name the container for easier access later:
sudo docker run --name="tmp-name" -e HOME=/root/ -i -t atlassian/bamboo-java-agent:latest /bin/bash
Now change whatever you want inside the container with the usual bash commands. You can enforce some capabilities by changing the file in
After that, exit and create a new image from the container like this:
sudo docker commit tmp-name atlassian/customized-agent:1.0.0
You can publish your new image by pushing it to the Docker Registry.
If you have DNS problems (i.e. the Docker container can ping the IP of the server but not the hostname) consider using this command:
sudo docker run –dns=your-dns-server-ip1 –dns=your-dns-server-ip2
You'll need to replace those values with the actual IP addresses of your DNS server.
If the agent seems to connect and start bootstrapping but has trouble with active mq then check on your Bamboo server that you have set up the broker URL correctly. Go to Administration > General configuration. You should not have 'localhost' specified there.