Sign inSign up

keks/mongodb

By keks

Updated almost 11 years ago

Ubuntu 14.04.2 LTS / MongoDB 3.0.4 for Cluster-Setup

Image
0

2.2K

keks/mongodb repository overview

Ubuntu 14.04.2 LTS / MongoDB 3.0.4 for Cluster-Setup

Dockerfile

FROM keks/ubuntu
MAINTAINER Jan M. <[email protected]>
# Install MongoDB.
# old versions: echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" > /etc/apt/sources.list.d/mongodb.list && \
RUN \
  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
  echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
RUN apt-get update && \
  apt-get install -y mongodb-org-server mongodb-org-shell mongodb-org-mongos && \
  rm -rf /var/lib/apt/lists/*

USER mongodb
# Define mountable directories.
VOLUME ["/data", "/cert"]

ENTRYPOINT [ "/usr/bin/mongod" ]

Cluster deploy suggestion:

  • start replica-set slaves
  • start replica-set masters
  • start replica-set arbiters (optional)
  • start config-servers
  • start query-routers
Startup example

for a Secondary in a Replica-Set "rs2"

docker run \
  -d -i -t \
  --restart=always \
  --add-host mongocfg0.my.domain:192.168.1.245 \
  --add-host mongocfg1.my.domain:192.168.1.246 \
  --add-host mongocfg2.my.domain:192.168.1.247 \
  -v /data/mongo-slave:/data \
  -p 27020:27020 \
  --entrypoint /usr/bin/mongod \
  --name mongo-sec-rs2 \
keks/mongodb --dbpath /data --noprealloc --port 27020 --replSet rs2 

mount the host folder /data/mongo-slave to /data (which will be used as the DBs storage), always keep the container running, run it on port 27020 (and make it accessible on the host system). The ENTRYPOINT should be the mongod executable and - because i want to move this setup over to another place later on and configservers cannot change - the hosts for the three configservers in .my.domain are added manually before i can add DNS resolution later.

older versions are also tagged: 3.0.1, 3.0.3

Tag summary

Content type

Image

Digest

sha256:08306d83a

Size

157 MB

Last updated

almost 11 years ago

docker pull keks/mongodb