Skip to content

Instantly share code, notes, and snippets.



Last active Oct 10, 2019
What would you like to do?
Some helpful docker commands for working with mongoDB

Some helpful mongo container docker commands

Get latest image of mongoDB

docker pull mongo

Spin up a new container named my_mongo from image mongo Mapping and exposing ports 27017-27019 from the container to the host OS: docker run -d -p 27017-27019:27017-27019 --name my_mongo mongo

Get an interactive shell in the container: docker exec -it my_mongo bash

docker stop my_mongo

docker start my_mongo

docker ps

docker images

docker container ls --all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment