Giter VIP home page Giter VIP logo

jupyter-notebook-docker-compose's Introduction

Jupyter with Docker Compose

This repository contains a simple docker-compose definition for launching the popular Jupyter Data Science Notebook. You can define a password with the script generate_token.py -p S-E-C-R-E-T and generate SSL certificates as described below.

Control the container:

  • docker-compose up mounts the directory and starts the container
  • docker-compose down destroys the container

The compose file: docker-compose.yml

version:  '3'
services:
  datascience-notebook:
      image:    jupyter/datascience-notebook
      volumes:
        - ${LOCAL_WORKING_DIR}:/home/jovyan/work
        - ${LOCAL_DATASETS}:/home/jovyan/work/datasets
        - ${LOCAL_MODULES}:/home/jovyan/work/modules
        - ${LOCAL_SSL_CERTS}:/etc/ssl/notebook
      ports:
        - ${PORT}:8888
      container_name:   jupyter_notebook
      command: "start-notebook.sh \
        --NotebookApp.password=${ACCESS_TOKEN} \
        --NotebookApp.certfile=/etc/ssl/notebook/jupyter.pem"

Example with a custom user

version: '2'
services:
    datascience-notebook:
        image: jupyter/base-notebook:latest
        volumes:
            - /tmp/jupyter_test_dir:/home/docker_worker/work            
        ports:
            - 8891:8888
        command: "start-notebook.sh"
        user: root
        environment:
          NB_USER: docker_worker
          NB_UID: 1008
          NB_GID: 1011
          CHOWN_HOME: 'yes'
          CHOWN_HOME_OPTS: -R

The environment file .env

# Define a local data directory
# Set permissions for the container:
#   sudo chown -R 1000 ${LOCAL_WORKING_DIR}

LOCAL_WORKING_DIR=/data/jupyter/notebooks

# Generate an access token like this
#   import IPython as IPython
#   hash = IPython.lib.passwd("S-E-C-R-E-T")
#   print(hash)
# You can use the script generate_token.py

ACCESS_TOKEN=sha1:d4c78fe19cb5:0c8f830971d52da9d74b9985a8b87a2b80fc6e6a

# Host port
PORT=8888

# Provide data sets
LOCAL_DATASETS=/data/jupyter/datasets

# Provide local modules
LOCAL_MODULES=/home/git/python_modules

# SSL
# Generate cert like this:
#   openssl req -x509 -nodes -newkey rsa:2048 -keyout jupyter.pem -out jupyter.pem
# Copy the jupyter.pem file into the location below.
LOCAL_SSL_CERTS=/opt/ssl-certs/jupyter

Version Conflicts

Make sure to have the latest versions installed. You can use the Notebook Browser interface.

pip install -U jupyter

jupyter-notebook-docker-compose's People

Contributors

stefanproell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jupyter-notebook-docker-compose's Issues

generate token

where is the generate_token.py script ran? inside the docker container or before the docker-compose up ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.