Mongo connect trouble

mongo
circle.yml

#1

version: 2
jobs:
build:
docker:
- image: docker:1.13.1-git
- image: mongo:3.4.3
environment:
MONGO_URL: mongodb://123.123.123.123:27017
- image: redis:3.2
environment:
REDIS_URL: redis://123.123.123.123:6391

After building private docker image

docker exec app_test sh -c “cd /app && MONGO_URL=mongodb://123.123.123.123:27017/app_test REDIS_URL=redis://123.123.123.123:6379/1 npm run ttest”

error

message: ‘failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]’,

How to attach image to private docker image before running ttest?


#2

I don’t understand your question. Can you link me to a build?


#3

https://circleci.com/gh/dmapper/idg/96


#4

You need to start Mongo and Redis instances in the remote Docker environment, not locally. They can’t connect.


#5

How to do this?

Could you give example, please?

Best regards, Alex.


#6

I don’t have a true example available. Just run it normally.

docker run --name some-mongo -d mongo

You’ll also need to link it for networking


#7

docker run --name mongo-master -d mongo

docker run --name “my_app” --link mongo-master:mongo -d app/my_app:v1 tail -f /dev/null

Same error.


#8

I run it with this:

  - image: circleci/node:6.10.3
  - image: circleci/mongo:3.4.4
  - image: redis:3.2.9
environment:
  - MONGO_URL: "mongodb://localhost:27017/data"
  - REDIS_URL: "redis://localhost:6379/2"

#9