我不能連接到與的MongoDB創建容器搬運工-組成無法連接到容器的MongoDB
的mongodb的配置(在搬運工-compose.yml)是如下:
mongodata:
image: mongo:3.0.4
volumes:
- /data/db
command: --break-mongo
mongo:
image: mongo:3.0.4
volumes_from:
- mongodata
ports:
- "27017:27017"
command: --smallfiles --rest --auth
當運行:
docker-compose ps mongo
我:
Name Command State Ports
------------------------------------------------------------------------------------
followit_mongo_1 /entrypoint.sh --smallfile ... Up 0.0.0.0:27017->27017/tcp
,我不能跟蒙戈客戶端,波紋管命令
docker-compose run mongo mongo
無法連接,這是錯誤:
MongoDB shell version: 3.0.4
connecting to: test
2015-11-10T17:10:32.735+0000 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-11-10T17:10:32.741+0000 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
我總是得到相同的錯誤:無法連接到服務器 –