Skip to content

Running and using Mongo locally

kaitoo1 edited this page Jul 24, 2021 · 1 revision

Some useful info for running and using Mongo locally

Run Mongo container

Default command:

docker run -p 27017:27017 mongo:4.4.6

(optional) You can also name the container in the above command so that's its easier to easier to start/stop the container and run the Mongo DB shell.

docker run -p 27017:27017 --name mongoContainer mongo:4.4.6 

If you name your container, the next you want to start it you can just use:

docker start mongoContainer 

Run Mongo DB shell to see data

Assuming you named the container mongoContainer:

docker exec -it mongoContainer mongo
Clone this wiki locally