running mongodb in docker code example
Example 1: mongodb docker
docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:4.0.4
Example 2: access mongodb running in docker
docker exec -it mongodb bash
mongo
docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:4.0.4
docker exec -it mongodb bash
mongo