Public Repository

Last pushed: 2 years ago
Short Description
Ubuntu 14.04.2 LTS / MongoDB 3.0.4 for Cluster-Setup
Full Description

Ubuntu 14.04.2 LTS / MongoDB 3.0.4 for Cluster-Setup

Dockerfile

FROM keks/ubuntu
MAINTAINER Jan M. <keks@keksfabrik.eu>
# 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

Docker Pull Command
Owner
keks