Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket pipeline - Docker connection refused

Haresh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 24, 2019

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

 

test-e2e:
docker-compose -f ${DOCKER_COMPOSE_FILE} up -d ${APP_NAME}
godog
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."git@bitbucket.org:".insteadOf "https://bitbucket.org/"
-
go get github.com/onsi/ginkgo/ginkgo - go get github.com/onsi/gomega/... - go get github.com/DATA-DOG/godog/cmd/godog
-
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 ("127.0.0.1:10077:10077"). 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.

test-e2e:
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).

Example:

Creating oracle-go ... 
Sleep 10
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
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

0 votes
Daniel June 14, 2022

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

0 votes
mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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
TAGS
AUG Leaders

Atlassian Community Events