Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi docker-compose #1

Open
wittayasutt opened this issue Sep 29, 2017 · 2 comments
Open

multi docker-compose #1

wittayasutt opened this issue Sep 29, 2017 · 2 comments

Comments

@wittayasutt
Copy link

ผมมี 2 project ที่ต้องรันพร้อมกันคือ client กับ api
ลองเอา docker-compose มาใช้ดู

ผมลองรัน api ด้วย docker-compose แต่รัน client แบบปกติ ใช้ได้ครับ (ซึ่งหมายความว่า api expose port ได้ถูกต้องแล้ว)
ทีนี้ผมลองรัน api และ client ด้วย docker-compose ทั้งคู่ ปรากฏว่าไม่ได้ client error ว่าหา port ของ api ไม่เจอ (econnrefused)

อยากสอบถามดูว่าต้อง setting docker-compose ยังไงให้ใช้ได้


ไฟล์ api (docker-compose)

version: '2'
services:
api:
build: .
command: npm start
volumes:
- ./:/app
- /app/node_modules
ports:
- '4000:4000'
links:
- mongo
networks:
- thesolar

mongo:
image: mongo
volumes:
- /data/db:/data/db
ports:
- '27017:27017'
networks:
- thesolar

networks:
thesolar:
driver: bridge

ไฟล์ client (docker-compose)

version: '2'
services:
client:
build: .
command: npm run develop
volumes:
- ./:/app
- /app/node_modules
ports:
- '3000:3000'
networks:
- project_thesolar

networks:
project_thesolar:
external: true

@up1
Copy link
Owner

up1 commented Sep 30, 2017

มันอยู๋ต่าง network กันครับ

@wittayasutt
Copy link
Author

ต้อง set ยังไงนะครับ ผมเคยลอง

networks:
thesolar:
driver: bridge

ทั้งคู่ก็ไม่ได้

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants