# Connection error accessing a container running REST on port :8080

**URL:** <https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572>\
**Category:** Deployment\
**Created:** [February 10, 2023, 8:18pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572 "2023-02-10T20:18:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![howtotalktogirls](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/howtotalktogirls/32/8432_2.png) [@howtotalktogirls](https://travis-ci.community/u/howtotalktogirls)\
**Post date:** [February 10, 2023, 8:18pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/1 "2023-02-10T20:18:06Z")

</div>

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**

```auto
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**

```auto
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?

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [February 10, 2023, 8:20pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/2 "2023-02-10T20:20:25Z")

</div>

Hello again @howtotalktogirls,

Something you have to keep in mind, the way Travis was designed is that mapped container ports are accessible on Travis in the same way they are accessible elsewhere. Are the test commands pass without a problem on your local machine? Also another suggestion - if you already have a `docker-compose` file, make the tests run as another container, this is sometimes called logical container separation and then on Travis you just run something like `docker-compose run tests`.

---

<div class="post-metadata">

**Author:** ![howtotalktogirls](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/howtotalktogirls/32/8432_2.png) [@howtotalktogirls](https://travis-ci.community/u/howtotalktogirls)\
**Post date:** [February 10, 2023, 8:27pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/3 "2023-02-10T20:27:24Z")

</div>

Hey @montana,

after adding docker-compose-run tests, this seemed to do the trick. im very grateful.

---

<div class="post-metadata">

**Author:** ![brainjhon011](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/brainjhon011/32/8507_2.png) [@brainjhon011](https://travis-ci.community/u/brainjhon011)\
**Post date:** [February 14, 2023, 6:43pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/4 "2023-02-14T18:43:42Z")

</div>

> [@Montana](#):
>
> Hello again @howtotalktogirls,
> 
> Something you have to keep in mind, the way Travis was designed is that mapped container ports are accessible on Travis in the same way they are accessible elsewhere. Are the test commands pass without a problem on your local machine? Also another suggestion - if you already have a `docker-compose` [file](https://alightmotionapps.com/alight-motion-pro-apk/), make the tests run as another container, this is sometimes called logical container separation and then on Travis you just run something like `docker-compose run tests`.

Thanks for providing perfect and accurate solution to the problem, This give me a valuable knowledge to me.

---

<div class="post-metadata">

**Author:** ![howtotalktogirls](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/howtotalktogirls/32/8432_2.png) [@howtotalktogirls](https://travis-ci.community/u/howtotalktogirls)\
**Post date:** [November 3, 2023, 4:17pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/6 "2023-11-03T16:17:37Z")

</div>

Had to re-find this, thanks again @Montana

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [November 3, 2023, 4:25pm UTC](https://travis-ci.community/t/connection-error-accessing-a-container-running-rest-on-port-8080/13572/7 "2023-11-03T16:25:29Z")

</div>

Thank you for the kind words everyone!
