Docker mongo image 'Connection refused' from other container

前端 未结 4 1949
予麋鹿
予麋鹿 2020-12-23 17:46

I\'m new to docker. I\'m trying to create a MongoDB container and a NodeJS container. My file looks:

version: \'2\'
services:
  backend:
    image: node:5.11         


        
4条回答
  •  旧巷少年郎
    2020-12-23 18:22

    In your backend app, connect to mongodb:27017 instead of 127.0.0.1:27017. Where 'mongodb' is the name of your service within docker-compose.yml.

提交回复
热议问题