I am quite new to docker. I am trying to configure mongodb and mongo-express in the same docker network. I created a network called some-network. Then I ran mongodb with this command to set up mongo in the same network, I ran the command:
docker run -d --network some-network --name some-mongo \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
-e MONGO_INITDB_ROOT_PASSWORD=secret \
mongo
However, when I run the command to configure mongo-express, I get an error:
docker run --network some-network -e ME_CONFIG_MONGODB_SERVER=some-mongo -p 8081:8081 mongo-express
Welcome to mongo-express
------------------------
(node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:7) UnhandledPromiseRejectionWarning: MongoError: command listDatabases requires authentication
at Connection.<anonymous> (/node_modules/mongodb/lib/core/connection/pool.js:453:61)
at Connection.emit (events.js:314:20)
at processMessage (/node_modules/mongodb/lib/core/connection/connection.js:456:10)
at Socket.<anonymous> (/node_modules/mongodb/lib/core/connection/connection.js:625:15)
at Socket.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Am I missing anything?, How do I use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor in docker?
I couldn't tell what the problem was but running these commands fixed the issue
To set up mongodb
And then mongo-express: