Cannot connect to the Docker daemon

I'm running Bamboo on an Ubuntu server, where I have installed Docker as well.
The docker command cannot be ran from within a bamboo plan, but there's no problem running it from the terminal.

The error in the build plan is /usr/bin/docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. but in fact the daemon background process and the service are running and I am able to lift containers directly from terminal...

I have added the ubuntu user to the docker groups, so that the docker commands can be ran without sudo, but I suspect that the Bamboo plans are ran with some other user (which I am not sure how to find out), and that is why Bamboo cannot run the docker ... commands.

Any thoughts/suggestions?

3 answers

1 accepted

This widget could not be displayed.

Hi,

This happens because the user running bamboo, usually bamboo in unable to connect to docker using the unix socket file, usually /var/run/docker.sock, which is owned by root.

# ls -l /var/run/docker.sock
srw-rw---- 1 root root 0 Dec 11 18:06 /var/run/docker.sock

You may change the group of this file to dockerroot and add the bamboo user to this group.

# chgrp bambooroot /var/run/docker.sock
srw-rw---- 1 root dockerroot 0 Dec 11 18:06 /var/run/docker.sock

# usermod -a -G dockerroot bamboo
# groups bamboo
bamboo : bamboo dockerroot
 

 

That's it ! You may enjoy running docker as user bamboo now, from terminal as well as bamboo plan.

Good Luck!

Sudesh K Kantila

Thanks Sudesh, 

Works now exactly like you described !

C.heers

This widget could not be displayed.

Hello Galin,

You could open a Terminal and check the user running the Bamboo process:

ps aux | grep bamboo

Also, is docker located under /usr/bin/docker ? If you list the directory, under which user/group the same is under?

ls -l /usr/bin/docker

Kind regards,
Rafael P. Sperafico

This widget could not be displayed.

Hi Galin,

I suffer exactly the same. under the bamboo user i even can run the same command that the log file produces.

Also tried variations like:
bin/sudo /usr/bin/docker 
sudo /usr/bin/docker 
docker  

add user bamboo to docker group

all to no avail.

Hope you solved it.

Regards,
Corné

Hi Corne,

See my reply to the initial question.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

72 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you