mongodbHow to install MongoDB with Docker?
-
Install Docker on your machine. Refer to the Docker installation guide for instructions.
-
Pull the MongoDB image from the Docker Hub.
docker pull mongo
- Run the MongoDB container.
docker run --name my-mongo -d mongo
- Check the container is running.
docker ps
Output example
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f8f9f9f9f9f9 mongo "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 27017/tcp my-mongo
- Connect to the MongoDB instance.
docker exec -it my-mongo mongo
Related
More of Mongodb
- How to use triggers in MongoDB?
- How to use unwind in MongoDB?
- How to list MongoDB users?
- How to rename a field in MongoDB?
- How to rename a MongoDB collection?
- What is MongoDB default port?
- How to convert MongoDB ObjectId to string?
- How to create a many to many relation in MongoDB?
- How to work with time series data in MongoDB?
- How to empty an array in MongoDB?
See more codes...