Bamboo: docker task "An error occurred trying to connect: Post http://127.0.0.1:2375/v1.22/build"
Asked Answered
B

1

0

I've been trying to set up an Continuous Delivery server with Bamboo. I've got everything going nicely up to the deployment. Bamboo builds and tests my C# project as it should.

Then I created a "deployment plan", installed docker and added the server capability to use docker, set up the docker tasks to build and deploy to dockerHub.

When I try to deploy, I get this error:

An error occurred trying to connect: Post http: //127.0.0.1:2375/v1.22/build ?buildargs=%7B%7D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&forcerm=1&memory=0&memswap=0&rm=1&shmsize=0&t=srgskiri%2Fresttest&ulimits=null : dial tcp 127.0.0.1:2375: connectex: No connection could be made because the target machine actively refused it. 01-mrt-2016 13:19:03 Failing task since return code of [C:\Program Files\Docker Toolbox\docker.exe build --force-rm=true --tag="srgskiri/resttest" C:\Users\Srg\bamboo-home\xml-data\build-dir\2129921-2195457] was 1 while expected 0

Now I think that it means that the bamboo 'object' that is calling the command to build, can't communicate with my docker engine/container.

First I thought it was because I didn't have docker-machine running, so I started it and ran the deploy, and still got this error.

This is what I have:

Server capability: path to docker

Docker task: building into an Image

Is there something I'm missing?

PS: Docker works perfectly on its own, both with docker UI or docker terminal. It's bamboo that can't interact with docker.

UPDATE: I didn't mention this, but I ran Bamboo in a Console, not as a service. Maybe thats the problem, that bamboo can't access docker out of console. I can't try this myself now because I can't install bamboo as a service. Keeps hanging if I try to start it as a service. Will ask the bamboo support about it.

Bagasse answered 1/3, 2016 at 13:2 Comment(0)
B
0

I figured it out... If u work on a Windows, Bamboo has to start the docker-machine itself.

So you have to add Command tasks to:

1) create a docker-machine (if u don't have any yet)

2) start it (if you start docker in bamboo, you can't access it in Windows and vice-versa)

only then you are able to use Docker in Bamboo on Windows.

I feel silly now

-EDIT- To use the Docker tasks after starting the docker-machine, you must also specify the Environment variables for the tasks (like DOCKER_TLS_VERIFY=1) Otherwise you'll get the error mentioned above.

Bagasse answered 3/3, 2016 at 10:19 Comment(1)
hi can u please share with me how you configured the task in windows environment?Belovo

© 2022 - 2024 — McMap. All rights reserved.