【发布时间】:2018-06-13 21:57:25
【问题描述】:
我是 docker 新手,所以我尝试连接多个容器
- 蒙哥
- 我的应用
- 雷迪斯
我在 chrome=> code: "ECONNREFUSED", errno: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8080}
这是我的 docker-compose 文件:
version: "2"
services:
mongo:
image: "mongo"
restart: always
ports:
- "27017:27017"
networks:
- all
redis:
image: "redis:3.2.1"
networks:
- all
node:
image: "project"
links:
- mongo
ports:
- "8080:8080"
networks:
- all
backoffice:
image: "back"
links:
- node
- mongo
- redis
depends_on:
- mongo
- node
- redis
ports:
- "8181:8181"
networks:
- all
networks:
all:
driver: bridge
我的不同 Dockerfile:
对于蒙哥:
来自 mongo:2.6
复制 ./data ./
暴露 27017
CMD ["mongod"]
对于服务节点:
FROM 节点:4.4.7
WORKDIR /app
复制 /api ./
运行 npm 安装
运行 apt-get -q update && apt-get install -y -qq \ git \ curl
曝光 8080
CMD ["node","index.js"]
返回服务:
FROM 节点:4.4.7
WORKDIR /api
复制。 ./
运行 npm install && npm install bower -g && npm install gulp -g
运行 bower install --allow-root && gulp build
运行 apt-get -q update && apt-get install -y -qq \ git \ curl
暴露 8181
CMD ["node","index.js"]
你能帮我解决这个问题吗?
【问题讨论】:
标签: node.js mongodb docker docker-compose mean-stack