Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How does one set up a Docker build step in Bamboo?

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.

1 answer

1 accepted

0 votes
Answer accepted

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

504 views 5 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you