Create a MongoDB Docker Container

Summary

Just a quick tip on creating a MongoDB container from the terminal.

Create the container

Create a Docker Network

docker network create mongo-network 

Create the MongoDB container instance

docker run -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --name mongodb --net mongo-network mongo    

Install Mongo-Express

docker run -d -p 8081:8081 -e ME_CONFIG_MONGODB_ADMINUSERNAME=admin -e ME_CONFIG_MONGODB_ADMINPASSWORD=password --net mongo-network --name mongo-express -e ME_CONFIG_MONGODB_SERVER=mongodb mongo-express   

Run the Mongo-Express application from the browser

http://localhost:3000

You must be logged in to post a comment.