Public Repository

Last pushed: 3 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


FROM keks/ubuntu
# Install MongoDB.
# old versions: echo "deb dist 10gen" > /etc/apt/sources.list.d/mongodb.list && \
  apt-key adv --keyserver hkp:// --recv 7F0CEB10 && \
  echo "deb "$(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 \
  --add-host \
  --add-host \
  -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