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:
FROM ubuntu:latest
# Installation:
# Import MongoDB public GPG key AND create a MongoDB list file
RUN apt-key adv --keyserver hkp:// --recv 7F0CEB10
RUN echo 'deb dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
#Set mongodb version
# 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