This repository contains a Dockerfile to build a Docker Image for MongoDB in CentOS 7.
-
Install Docker.
-
You can download automated build from public Docker Hub Registry:
docker pull zokeber/mongodb:latest
Another way: build from Github
To create the image zokeber/mongodb, clone this repository and execute the following command on the docker-mongodb folder:
docker build -t zokeber/mongodb:latest .
Another alternatively, you can build an image directly from Github:
docker build -t="zokeber/mongodb:latest" github.com/zokeber/docker-mongodb
Create container:
docker create -it -p 27017:27017 --name mongodb zokeber/mongodb
Start container:
docker start mongodb
Mongo interactive shell:
docker exec -it mongodb mongo
Bash:
docker exec -it mongodb bash
Stop the currently running image:
docker stop mongodb
Update the docker image:
docker pull zokeber/mongodb:latest