Docker Community Forums

Share and learn in the Docker community.

Linked endpoint unreachable

docker

(David Knezić) #1

I’m having an issue connecting the mongo CLI tool to a mongod container. Since it works locally I guess this could be an issue with Docker Cloud links.

These are my two containers:

cli:
  image: 'mongo:latest'
  command: 'sh -c ''exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'''
  links:
    - 'db:mongo'
db:
  image: 'mongo:latest'

While the db service starts successfully, the cli container fails with this error:

MongoDB shell version: 3.2.6
connecting to: 10.7.0.7:27017/test
2016-05-15T23:10:32.835+0000 W NETWORK [thread1] Failed to connect to 10.7.0.7:27017, reason: errno:113 > No route to host
2016-05-15T23:10:32.836+0000 E QUERY [thread1] Error: couldn’t connect to server 10.7.0.7:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:231:14
@(connect):1:6

exception: connect failed

Now the same happens if I expose the db port:

db:
  image: 'mongo:latest'
  ports:
    - '27017:27017'

Could anyone try the Stackfile from above? In my opinion this should work, as it does with the latest Docker version on my computer.


(Zommerfelds) #2

Hi David,

We might be experiencing the same issue. Does yours sound similar to [Resolved] Linked container regularly becomes unreachable?

Cheers