You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I am currently despairing at the attempt of setting up a docker build step in Bamboo.
For starters, I just want to create a build configuration that runs the hello-world image as a proof of confluence. So far, I have failed.
I have tried following the steps on https://confluence.atlassian.com/bamboo0609/using-bamboo/jobs-and-tasks/configuring-tasks/configuring-the-docker-task-in-bamboo , but to no avail.
My setup is this:
We have Bamboo installed on an Ubuntu server. I also installed Docker on that server and added the `bamboo` user to the `docker` usergroup and restarted the server to make sure the permission change takes effect. At this point, `docker run hello-world` works when I run it directly on the server. I can also confirm that this is the server that Bamboo runs on since Bamboo went offline whenever I restarted the server that I installed Docker on.
Then, I have added the docker capability to the server (the agent is the default agent, so it inherits this capability from the server). As the docker path, I have tried various things, none of which worked (aka, the following errors remained the same for each of these):
* `/snap/docker` (the first folder that I found on a manual search)
* `/usr/bin/docker` (the recommended path, though on inspecting the Ubuntu server I quickly found out that no `docker` folder exists under `/usr/bin` on the Ubuntu derver)
* `/var/snap/docker/common/var-lib-docker ` (the path that Docker returns as its Root Directory when I run `docker info` on the Ubuntu server)
* `/var/snap/docker` (for good measure)
Now, for the runner, I have tried two different approaches.
First, I tried using a Docker runner with the following settings:
**Command:** Run a Docker container
**Docker image:** hello-world
This returns the following error message:
Error occurred while running Task 'Hello World Docker Test(5)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli.com.atlassian.bamboo.task.TaskException: Failed to execute task
Caused by: com.atlassian.bamboo.docker.DockerException: Error running Docker run command
Caused by: com.atlassian.utils.process.ProcessException: Error executing /snap/docker run --volume /var/atlassian/application-data/bamboo/xml-data/build-dir/CAM-DOC-JOB1:/data --workdir /data --rm hello-world
The second was just to run a shell runner for the command `docker run hello-world`, which returned the following error:
docker: not found
At this point, I feel like I'm out of ideas. Everything points towards Bamboo for some reason not finding Docker on the server, even though I can clearly confirm that it is there. I have tried various different approaches of telling Bamboo where to find Docker, but none of them have worked.
It's obvious that I'm doing something wrong, but I can't figure out what. Or maybe the problem lies in an entirely different direction altogether? Anyway, I would be grateful for any insight shared on this matter.
Okay, I found out what caused this strange behaviour.
The problem was that I installed Docker using `sudo snap install docker`, and apparently installing docker via snap causes problems with Bamboo.
So I got it to work using these simple steps:
1. [Server] Uninstalled Snap Docker using `sudo snap remove docker`
2. [Server] Reinstalled Docker using `sudo apt install docker.io`
3. [Bamboo] Changed the path to Docker in the Server Capabilities to `/usr/bin/docker`
After that, the hello-world image build succeeded and printed the expected output to the log.