Error 1:
Add stdin_open: true
to your react
service, like:
...
services:
react: #name of first service
build: client #specify the directory of docker file
stdin_open: true
ports:
- "3000:3000" #specify port mapping
...
You might need to rebuild or clean cached so “docker-compose up –build” or “docker-compose build –no-cache” then “docker-compose up“
Error 2:
In your database connections line in your index.js file or whatever you named should have :
mongodb://database:27017/
where “database” is your named MongoDB service. You can use your container IP address too with docker inspect <container>
and use the IP the see there too. Ideally you want to have a ENV in your Dockerfile or docker-compose.yml
:
ENV MONGO_URL mongodb://database:27017/