I can’t get Docker running with my Travis CI runner.
I am running a REST API in a Docker container with a public port 8080. I can verify the container launches without fault and that the container is running at 0.0.0.0:8080.
I have a script that contains Newman (from Postman.)
When using curl I get this error curl: (56) Recv failure: Connection reset by peer
.
Are container ports not accessible within the job/worker?
docker-compose.yml
version: "2"
services:
db:
container_name: api-db
image: mysql:5.7.22
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: api_db
MYSQL_USER: devadmin
MYSQL_PASSWORD: password
volumes:
- db_data:/var/lib/mysql
ports:
- 3366:3306/tcp
networks:
- web
rest-api:
container_name: rest-api
build: .
depends_on:
- db
command: "python manage.py runserver 0.0.0.0:8000"
privileged: true
restart: always
ports:
- 8080:8000/tcp
networks:
- web
links:
- db:mysql
volumes:
- ../../app:/app
networks:
web:
driver: bridge
volumes:
db_data:
driver: local
.travis.yml
language: node_js
node_js:
- "8.2.1"
services:
- docker
before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
install:
- docker-compose -f docker/dev/docker-compose.yml up -d
- npm install newman
before_script:
- node --version
- npm --version
- node_modules/.bin/newman --version
- docker ps
script:
- curl localhost:8080/testendpoint/
- node_modules/.bin/newman run tests/postman/API.postman_collection.json -e tests/postman/Testing.postman_environment.json
Any idea?