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 check the version of MongoDB?
- How to work with time series data in MongoDB?
- How to empty an array in MongoDB?
- How to use watch in MongoDB?
- How to update many documents in MongoDB?
- How to use unwind in MongoDB?
- How to use triggers in MongoDB?
- How to list MongoDB users?
- How to perform a health check for MongoDB?
- How to use the limit operator in MongoDB?
See more codes...