Sunday, 17 February 2019

Struggling with a Node container connecting to a Mongo container using docker

So node can connect to mongo just fine on localhost, pre-docker. However, I can't see to be able to retrieve any documents or upload any to my mongo container.​As far as I know, my URL is correct which seems to be the most common reason why this doesn't work (according to many responses on stackoverflow).​My docker compose file also appears to be correct according to what other people have done for the same thing.​Do people have advice on what I should check in an attempt to get it working?​Edit:Config File:version: '3.3' services: reactjs: build: ./react container_name: "reactjs" image: solariser/entropy:reactjs restart: always ports: - "3000:80" volumes: - ./react:/react - /react/node_modules depends_on: - nodejs links: - nodejs nodejs: build: ./node container_name: "nodejs" image: solariser/entropy:nodejs restart: always ports: - "5000:5000" volumes: - ./api:/api - /node_modules - 'mongo:/data/db' depends_on: - mongo links: - 'mongo:mongo' mongo: container_name: "mongo" image: mongo:latest restart: always volumes: - 'mongo:/data/db' expose: - 27017 ports: - "27017:27017" volumes: mongo: {} ​

Submitted February 17, 2019 at 08:38PM by DontEatNitrousOxide

No comments:

Post a Comment