mozilla

Run Talk,Redis,Mongo in different docker container


#1

Hi all,

I´m trying to not use the existing docker-compose file but running three different docker instances:

docker run --name redisdocker -p 127.0.0.1:6379:6379 -d redis

docker run --name mongodocker -p 127.0.0.1:27017:27017 -d mongo

docker run -d -t -i -e NODE_ENV='development' -e TALK_MONGO_URL='mongodb://127.0.0.1:27017/talk' -e TALK_REDIS_URL='redis://127.0.0.1:6379' -e TALK_ROOT_URL='http://127.0.0.1:3000' -e TALK_PORT='3000' -e TALK_JWT_SECRET='password' -p 3000:3000 --name talkdocker coralproject/talk

Checking the logs (docker logs talkdocker) shows that talk is not able to connect to the mongodb.

{ MongoError: failed to connect to server [127.0.1.1:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.1.1:27017]

I know it is more a docker question then talk question, but maybe someone can support here.

Many thanks in advance.


#2

Problem solved. Using the docker container IP (use docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
to get the IP) seems to solve the problem.
Can be closed.


#3

Great, thanks Simon!