Access to MongoDB service from docker container

I’m trying to setup mongo db service on Travis to be used for my integration tests running in the docker container. My travis configuration that initializes mongodb is:

env:
  global:
    - MONGODB_URI: mongodb://fillrx_test:test@127.0.0.1:27017/fillrx_test_db
services:
  - docker
  - mongodb

before_install:
  - sleep 15
  - mongo fillrx_test_db --eval 'db.createUser({user:"fillrx_test", pwd:"test",roles:["readWrite"]});'
  - docker build -t jeremycod/api-test -f ./server/Dockerfile.dev ./server

script:
  - docker run --env MONGODB_URI -e CI=true jeremycod/api-test npm test

after_success:
  - docker build -t jeremycod/fillrx-client ./client
  - docker build -t jeremycod/fillrx-nginx ./nginx
  - docker build -t jeremycod/fillrx-api ./server
  # Log in to the docker CLI
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin

  # Take those images and push them to docker hub
  - docker push jeremycod/fillrx-client
  - docker push jeremycod/fillrx-nginx
  - docker push jeremycod/fillrx-api

deploy:
  provider: elasticbeanstalk
  region: 'ca-central-1'
  app: 'Fillrx'
  env: 'Fillrx-env'
  bucket_name: 'mys3bucketname'
  bucket_path: 'assets'
  on:
    branch: master
  access_key_id: $AWS_ACCESS_KEY
  secret_access_key: $AWS_SECRET_KEY

However, this fails on Travis with the connection refused error:

1) Create address endpoint /api/v1/address/user/userId

       "before all" hook: connectToTestDB for "Create address with correct input":

       MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017

       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)  {

            name: 'MongoNetworkError'

       }]

Obviously, MongoDB service is not available from the docker container on this address, but I can’t find anywhere in documentation how to correctly setup this.

Anyone can help with this?

Thanks