Dockerizing MongoDB

Hi Docker Enthusiasts,
I am new to Docker and was looking to dockerize MongoDB. I want to setup multiple mongodb replica set/sharded clusters on a single AWS EC2 instance. However I want the flexibility of upgrading each mongodb cluster separately.

  • Will the docker image for each mongodb instance use the same mongod binaries installed on the VM, or each image uses a separate mongod install?

  • if all images use the same mongod binaries, will all the Docker images get updated if the underlying binaries are upgraded?

Just wanted to figure out if this implementation possible with docker.

Appreciate all the help!

Thanks
CJ

Not sure why you want to setup multiple mongodb replica set/sharded clusters on a single EC2 instance. Looks you would have to use docker run with different exposed port for the mongodb containers to talk with each other.

You would be able to specify the mongodb container image at docker run. For example, docker run -d --name mongo1 mongo:tag. Different mongo docker images will use their own mongod. If one image is updated, other images will not get impacted.