Skip to content

Instantly share code, notes, and snippets.

@briskgopesh
Forked from jaso514/Dockerfile
Created July 18, 2022 08:47
Show Gist options
  • Save briskgopesh/980417f049248c8633ac0dc7b2543179 to your computer and use it in GitHub Desktop.
Save briskgopesh/980417f049248c8633ac0dc7b2543179 to your computer and use it in GitHub Desktop.

Revisions

  1. @jaso514 jaso514 revised this gist Jul 7, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,8 @@
    # - Run the mongo database:
    # > mongod
    # - To connect compass or another gui with mongo use the IP of docker: 192.168.99.100 and the port 27019, or another that you indicate in the command
    # https://stackoverflow.com/questions/33558506/how-to-create-a-mongo-docker-image-with-default-collections-and-data
    # https://stackoverflow.com/questions/43575295/how-to-import-data-to-mongodb-container-and-creating-an-image

    FROM ubuntu:16.04
    MAINTAINER Docker
  2. @jaso514 jaso514 revised this gist Jun 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    # http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
    # INSTRUCTIONS:
    # - Create the contianer:
    # > docker build -t pymongo .
    # > docker build -t ubuntu_pymongo .
    # - Create a folder to share your project in your host with the container. Ex: ~/shared
    # - Run the next command (need the route of the created shared folder), this command access to the bash of container:
    # > docker run -v /c/Users/Jhonny/Documents/vm_share/mongoDB/shared:/data/code -t -i -p 27019:27017 ubuntu_pymongo
  3. @jaso514 jaso514 created this gist Jun 18, 2018.
    48 changes: 48 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    # Dockerizing Python and MongoDB
    # Based on ubuntu:latest, installs MongoDB following the instructions from:
    # http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
    # INSTRUCTIONS:
    # - Create the contianer:
    # > docker build -t pymongo .
    # - Create a folder to share your project in your host with the container. Ex: ~/shared
    # - Run the next command (need the route of the created shared folder), this command access to the bash of container:
    # > docker run -v /c/Users/Jhonny/Documents/vm_share/mongoDB/shared:/data/code -t -i -p 27019:27017 ubuntu_pymongo
    # - To open another bash console run the command:
    # > docker exec -it <id_contenedor> bash
    # - Run the mongo database:
    # > mongod
    # - To connect compass or another gui with mongo use the IP of docker: 192.168.99.100 and the port 27019, or another that you indicate in the command

    FROM ubuntu:16.04
    MAINTAINER Docker

    # Installation:
    RUN apt-get update && apt-get install -y build-essential python2.7
    RUN apt-get install -y python-setuptools
    RUN apt-get install -y python-pip
    RUN apt-get install -y nano
    RUN apt-get install -y telnet
    RUN apt-get install -y vim

    # Import MongoDB public GPG key AND create a MongoDB list file
    RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv 7F0CEB10
    RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list

    # Update apt-get sources AND install MongoDB
    RUN apt-get update && apt-get install -y mongodb-org

    # Create the MongoDB data directory
    RUN mkdir -p /data/db

    # Create the MongoDB data directory
    RUN mkdir -p /data/code

    RUN pip install bottle

    RUN pip install pymongo

    # Expose port #27017 from the container to the host
    EXPOSE 27017

    # Set /usr/bin/mongod as the dockerized entry-point application
    ENTRYPOINT ["/bin/bash"]