Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket pipeline - Docker connection refused

Stripping out the details I have a make file which looks as follows to run some form of integration tests.


docker-compose -f ${DOCKER_COMPOSE_FILE} up -d ${APP_NAME}
docker-compose -f ${DOCKER_COMPOSE_FILE} down

Docker compose is a single webserver with ports exposed.


Pipeline looks as follows:

 - step: &integration-testing 
name: Run integration tests script: # do this to make go module work with private repo
apk add libc-dev py-pip python-dev libffi-dev openssl-dev gcc libc-dev make bash
pip install docker-compose - git config --global url."".insteadOf ""
go get - go get - go get
make build-only && make test-e2e 


I am facing two separate issues for both i have not been able to find a solution.

1. Keep getting connection refused when the tests are run.

To elaborate above, the docker compose brings up a server with proper host:port mapping (""). The command godog is intended to run the tests by querying the server. This however always ends in connection refused.This link  has a possible solution , so i am exploring that.


2. The pipeline almost always runs commands before the container is up. I've tried fixing this by changing the invoke to.

docker-compose -f ${DOCKER_COMPOSE_FILE} up -d ${APP_NAME} && sleep 10 && docker exec -i oracle-go godog && docker-compose -f ${DOCKER_COMPOSE_FILE} down

However the container is always brought up after the sleep (almost instantaneously).


Creating oracle-go ... 
Sleep 10
docker exec -i oracle-go godog
Creating oracle-go ... done
Error response from daemon: Container 7bab5322203756b972e7f0a3c6e5827413279914a68c705221b8af7daadc1149 is not running


Please let me know if there is a way around it.

2 answers

Having this exact problem. Did you find a solution for it?

0 votes
mkleint Atlassian Team Mar 12, 2020

can both issues be caused by the docker-compose command either not starting up the containers properly or by the containers immediately exiting? You will probably need to examine the container logs (if any) to see what is going on. Another possibility for the port not being accessible is slow startup of the web application. Docker daemon logs could also be useful here.

You can also try increasing the size of the pipelines build and the amount of memory available to the docker daemon service where your containers are running.


Hope that helps

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,085 views 2 9
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