1
I want to make a connection through Robo3t of a Mongodb database that is running via Docker-Compose.
version: '3'
services:
mongo-express:
image: mongo-express
container_name: mongo-express
ports:
- 8081:8081
environment:
ME_CONFIG_BASICAUTH_USERNAME: <usuario>
ME_CONFIG_BASICAUTH_PASSWORD: <senha>
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: <senha>
links:
- mongo
networks:
- mongo-network
mongo:
image: mongo
container_name: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: <usuario>
MONGO_INITDB_ROOT_PASSWORD: <senha>
ports:
- 27017:27017
volumes:
- ./datadir:/data/db
networks:
- mongo-network
networks:
mongo-network:
driver: bridge
I’ve tried to change the authentication mechanisms and ports but gives the same message:
Cannot connect to the MongoDB at localhost:27017.
Error:
Authentication failed.