I am been trying this for a few days now. I have two container in a docker compose file. My mongodb container is running ok but my rocketchat container is unable to connect to mongodb.
This is the error log from my rocketchat container
error: 'An error occurred when creating an index for collection "users: connect ECONNREFUSED 127.0.0.1:27017'
This is my Docker-compose.yml
version: '3'
services:
rocketchat:
image: rocketchat/rocket.chat:latest
ports:
- "3000:3000"
environment:
- MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs0
- MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs0
- ROOT_URL=http://localhost:3000
- PORT=3000:3000
depends_on:
- mongo
expose:
- 3000:3000
restart: unless-stopped
networks:
- rocketchat-network
mongo:
image: mongo:5
volumes:
- ./data:/data/db
command: mongod --oplogSize 128 --replSet rs0
expose:
- 27017:27017
restart: unless-stopped
networks:
- rocketchat-network
networks:
rocketchat-network:
driver: bridge