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 watch in MongoDB?
- How to update one document in MongoDB?
- How to join two collections in MongoDB?
- How to use triggers in MongoDB?
- How to use unwind in MongoDB?
- How to list MongoDB users?
- How to use MongoDB queue?
- How to drop a database in MongoDB?
- How to remove a field from MongoDB?
- How to check the version of MongoDB?
See more codes...