Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
mongoDB Dockerfile for demoing Docker storage options
# Dockerizing MongoDB: Dockerfile for building MongoDB images
# Based on ubuntu:latest, installs MongoDB following the instructions from:
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
FROM ubuntu:latest
MAINTAINER Grace <grapesfrog@gmail.com>
# Installation:
# Import MongoDB public GPG key AND create a MongoDB list file
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
#Set mongodb version
ENV MONGO_VERSION 2.6.5
# Update apt-get sources AND install MongoDB
RUN apt-get update && apt-get install -y mongodb-org=$MONGO_VERSION mongodb-org-server=$MONGO_VERSION mongodb-org-shell=$MONGO_VERSION mongodb-org-mongos=$MONGO_VERSION mongodb-org-tools=$MONGO_VERSION
# Define the MongoDB data directory
VOLUME ["/data/db"]
# Expose port 27017 from the container to the host
EXPOSE 27017
# Set /data/mongod as the dockerized entry-point application
ENTRYPOINT /usr/bin/mongod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment