Sign inSign up

rhyscampbell/dockermongodb

By rhyscampbell

•Updated over 6 years ago

A CentOS Docker Image with MongoDB Installed

Image
0

1.0K

rhyscampbell/dockermongodb repository overview

⁠MongoDB Docker Image

This Docker Image runs MongoDB in CentOS 8 and exposes the following ports...

  • 27017 - mongod port

⁠Build and run the Docker image

docker build -t mongodb .
docker volume create mongo
docker run -tid --mount source=mongo,target=/var/lib/mongo --rm -p 27017:27017 --name mongodb mongodb
docker container ls

⁠Verify ports are open on host

  • MacOS
netstat -anp tcp | grep LISTEN
  • Linux
netstat -tulpn | grep LISTEN

⁠Access the MongoDB instance from the host

mongo

The instance is setup with a replset flag so you probably want to....

mongo> rs.initiate();

⁠Delete the container volumes

docker volume rm mongo

⁠TODO

  • Add auth?

Tag summary

Content type

Image

Digest

Size

276.4 MB

Last updated

over 6 years ago

docker pull rhyscampbell/dockermongodb