Public Repository

Last pushed: 3 years ago
Short Description
Basic mongodb image to use for master or slave setup
Full Description
FROM dockerfile/ubuntu
ENV TYPE master
RUN \
  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
  echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' > /etc/apt/sources.list.d/mongodb.list && \
  apt-get update && \
  apt-get install -y mongodb-org && \
  rm -rf /var/lib/apt/lists/*
VOLUME ["/mnt/ebs_mongo_${TYPE}/mongo"]
WORKDIR /etc
RUN \
  echo "dbpath=/mnt/ebs_mongo_${TYPE}/mongo" > mongod.conf && \
  echo 'logpath=/var/log/mongodb.log' >> mongod.conf && \
  echo 'logappend=true' >> mongod.conf && \
  echo 'port=27017' >> mongod.conf && \
  echo 'auth=true' >> mongod.conf && \
  if [ $TYPE = 'slave' ]; then \
    echo 'slave=true' >> mongod.conf ; \
  else \
    echo 'slave=false' >> mongod.conf ; \
  fi
CMD ["mongod", "--config", "/etc/mongod.conf"]
# MONGO SHELL
EXPOSE 27017
# HTTP
EXPOSE 28017


# USAGE (to state the obvious)
# In the foreground
# docker run -e TYPE=master --name mongodb -p 30000:27017 -p 30001:28017 -it seamyd/mongodb:v2
# As a deamon
# docker run -e TYPE=master --name mongodb -p 30000:27017 -p 30001:28017 -d seamyd/mongodb:v2
Docker Pull Command
Owner
seamyd