From db3f9ac81600f40fbbb8aa3849f3d8285473419b Mon Sep 17 00:00:00 2001 From: Paul Lorett Amazona Date: Wed, 22 Feb 2017 22:02:34 +0800 Subject: [PATCH 01/44] added r-notebook --- {dockerPython => python3-notebook}/Dockerfile | 0 {dockerPython => python3-notebook}/readme.md | 0 .../requirements.txt | 0 r-notebook/.dockerignore | 2 + r-notebook/Dockerfile | 36 ++++++ r-notebook/README.md | 118 ++++++++++++++++++ 6 files changed, 156 insertions(+) rename {dockerPython => python3-notebook}/Dockerfile (100%) rename {dockerPython => python3-notebook}/readme.md (100%) rename {dockerPython => python3-notebook}/requirements.txt (100%) create mode 100644 r-notebook/.dockerignore create mode 100644 r-notebook/Dockerfile create mode 100644 r-notebook/README.md diff --git a/dockerPython/Dockerfile b/python3-notebook/Dockerfile similarity index 100% rename from dockerPython/Dockerfile rename to python3-notebook/Dockerfile diff --git a/dockerPython/readme.md b/python3-notebook/readme.md similarity index 100% rename from dockerPython/readme.md rename to python3-notebook/readme.md diff --git a/dockerPython/requirements.txt b/python3-notebook/requirements.txt similarity index 100% rename from dockerPython/requirements.txt rename to python3-notebook/requirements.txt diff --git a/r-notebook/.dockerignore b/r-notebook/.dockerignore new file mode 100644 index 0000000..9dea340 --- /dev/null +++ b/r-notebook/.dockerignore @@ -0,0 +1,2 @@ +# Documentation +README.md diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile new file mode 100644 index 0000000..ab64a4e --- /dev/null +++ b/r-notebook/Dockerfile @@ -0,0 +1,36 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +FROM jupyter/minimal-notebook + +MAINTAINER Jupyter Project + +USER root + +# R pre-requisites +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + fonts-dejavu \ + gfortran \ + gcc && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER $NB_USER + +# R packages +RUN conda config --add channels r && \ + conda install --quiet --yes \ + 'r-base=3.3.2' \ + 'r-irkernel=0.7*' \ + 'r-plyr=1.8*' \ + 'r-devtools=1.12*' \ + 'r-tidyverse=1.0*' \ + 'r-shiny=0.14*' \ + 'r-rmarkdown=1.2*' \ + 'r-forecast=7.3*' \ + 'r-rsqlite=1.1*' \ + 'r-reshape2=1.4*' \ + 'r-nycflights13=0.2*' \ + 'r-caret=6.0*' \ + 'r-rcurl=1.95*' \ + 'r-crayon=1.3*' \ + 'r-randomforest=4.6*' && conda clean -tipsy diff --git a/r-notebook/README.md b/r-notebook/README.md new file mode 100644 index 0000000..41808db --- /dev/null +++ b/r-notebook/README.md @@ -0,0 +1,118 @@ +![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") + +# Jupyter Notebook R Stack + +## What it Gives You + +* Jupyter Notebook 4.3.x +* Conda R v3.3.x and channel +* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed +* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom +* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` +* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command +* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub +* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) +* Options for a self-signed HTTPS certificate and passwordless `sudo` + +## Basic Use + +The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. + +``` +docker run -it --rm -p 8888:8888 jupyter/r-notebook +``` + +Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. + +## Notebook Options + +The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. + +You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' +``` + +For example, to set the base URL of the notebook server, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path +``` + +For example, to disable all authentication mechanisms (not a recommended practice): + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' +``` + +You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. + +## Docker Options + +You may customize the execution of the Docker container and the command it is running with the following optional arguments. + +* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. +* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) +* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** +* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). + +## SSL Certificates + +You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder:/etc/ssl/notebook \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key + --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt +``` + +Alternatively, you may mount a single PEM file containing both the key and certificate. For example: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.certfile=/etc/ssl/notebook.pem +``` + +In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). + +For additional information about using SSL, see the following: + +* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. +* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. +* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. + + +## Alternative Commands + +### start-singleuser.sh + +[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: + +```python +# Spawn user containers from this image +c.DockerSpawner.container_image = 'jupyter/r-notebook' + +# Have the Spawner override the Docker run command +c.DockerSpawner.extra_create_kwargs.update({ + 'command': '/usr/local/bin/start-singleuser.sh' +}) +``` + +### start.sh + +The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: + +``` +docker run -it --rm jupyter/r-notebook start.sh ipython +``` + +This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. + +### Others + +You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). From 073abe1fa1216c3180e7720671f039fff4f975df Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sun, 26 Feb 2017 11:33:31 +0800 Subject: [PATCH 02/44] introduction and install --- readme.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..fca3587 --- /dev/null +++ b/readme.md @@ -0,0 +1,43 @@ +# Contents + +- [Introduction](#introduction) +- [Installation](#isntallation) + +## Introduction + +*Contain Yourself* provides volunteers of DataKind Singapore a consistent enviroment when working on a project. By containerizing our tools we can be: + +- inclusive of volunteers who are running Windows/MacOS/Linux +- more productive by reducing frictions in working on different platforms +- reproducible by sending containers with code to our partners, ready to run no matter what environment they're using + +### What are containers (in the software sense)? + +Containers are a virtual operating system that can run applications or processes the same way regardless of the actual host operating system. For example, somebody who has Windows installed on their laptop can: + +1. develop an application within a container +2. pass that container to her project members +3. run the application on their machines regardless of their operating system +4. get the same results from running the application + +We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in this repo. [Insert explanation of quay.io] + +## Installation + +### ... for Windows + +Follow the setup instructions here: https://docs.docker.com/docker-for-windows/install/ + +### ... for Linux + +Follow the setup instructions for your flavor of Linux here: https://docs.docker.com/engine/installation/linux/ + +### ... for MacOS + +Follow the setup instructions here: https://docs.docker.com/docker-for-mac/install/ + +Or if you use homebrew, + +``` +$ brew install docker +``` From ebe88b5ce90e5d59a9983dcd0bbb8f2b68edf639 Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sun, 26 Feb 2017 16:31:22 +0800 Subject: [PATCH 03/44] update mac installation instructions --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index fca3587..7ebdb27 100644 --- a/readme.md +++ b/readme.md @@ -36,8 +36,8 @@ Follow the setup instructions for your flavor of Linux here: https://docs.docker Follow the setup instructions here: https://docs.docker.com/docker-for-mac/install/ -Or if you use homebrew, +Or if you use Homebrew Cask, ``` -$ brew install docker +$ brew cask install docker ``` From f96b6269a3fb8f18cfc3d68f0361bfccbb793877 Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sun, 26 Feb 2017 18:51:14 +0800 Subject: [PATCH 04/44] running docker --- readme.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7ebdb27..ca07441 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,8 @@ # Contents - [Introduction](#introduction) -- [Installation](#isntallation) +- [Installation](#installation) +- [Using Docker](#using-docker) ## Introduction @@ -41,3 +42,42 @@ Or if you use Homebrew Cask, ``` $ brew cask install docker ``` + +## Using Docker + +Start running the Docker app. Check that it is running on the command line: + +``` +$ docker info +Containers: 3 + Running: 0 + Paused: 0 + Stopped: 3 +Images: 1 +Server Version: 1.13.1 +... +``` + +### Jupyter Python Notebook + +You can pull down the image with: + +``` +$ docker pull quay.io/dksg/python3-notebook +``` + +Once that finishes downloading, you should see something like: + +``` +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +quay.io/dksg/python3-notebook latest f01e49a5a922 3 days ago 2.61 GB +``` + +Take that `IMAGE ID` and start it up with this command: + +``` +run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 +``` + +You will get instructions for link to paste into your browser address box. From 27e86fe7f3cf9e333e4c0d67197df76b23a2ac7c Mon Sep 17 00:00:00 2001 From: KSm Date: Wed, 1 Mar 2017 21:14:54 +0800 Subject: [PATCH 05/44] Updated README to add a note on using Docker Toolbox & R Notebook and fix minor typos. --- readme.md | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index ca07441..f209fc7 100644 --- a/readme.md +++ b/readme.md @@ -14,12 +14,12 @@ ### What are containers (in the software sense)? -Containers are a virtual operating system that can run applications or processes the same way regardless of the actual host operating system. For example, somebody who has Windows installed on their laptop can: +Containers are a virtual operating system that can run applications or processes the same way regardless of the actual host operating system. For example, somebody who has Windows installed on their laptop can: 1. develop an application within a container -2. pass that container to her project members -3. run the application on their machines regardless of their operating system -4. get the same results from running the application +2. pass that container to her project members +3. run the application on their machines regardless of their operating system +4. get the same results from running the application We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in this repo. [Insert explanation of quay.io] @@ -37,7 +37,7 @@ Follow the setup instructions for your flavor of Linux here: https://docs.docker Follow the setup instructions here: https://docs.docker.com/docker-for-mac/install/ -Or if you use Homebrew Cask, +Or if you use Homebrew Cask, ``` $ brew cask install docker @@ -77,7 +77,35 @@ quay.io/dksg/python3-notebook latest f01e49a5a922 3 days a Take that `IMAGE ID` and start it up with this command: ``` -run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 +docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 ``` -You will get instructions for link to paste into your browser address box. +You will get instructions for link to paste into your browser address box. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100/) + +Note: /path/to/local/directory would be the path to the directory in where you store your .ipynb + +### Jupyter R Notebook + +You can pull down the image with: + +``` +$ docker pull quay.io/dksg/r-notebook +``` + +Once that finishes downloading, you should see something like: + +``` +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +quay.io/dksg/r-notebook latest 0fd93ce8a437 3 days ago 2.63 GB +``` + +Take that `IMAGE ID` and start it up with this command: + +``` +docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work 0fd93ce8a437 +``` + +You will get instructions for link to paste into your browser address box. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100/) + +Note: /path/to/local/directory would be the path to the directory in where you store your .ipynb From 8ce9d3d9c90548c81363fcae97e96cd7bb489827 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Mar 2017 00:15:19 +0800 Subject: [PATCH 06/44] Update Dockerfile added r-plotly=4.5.2 --- r-notebook/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index ab64a4e..7f92b93 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -33,4 +33,5 @@ RUN conda config --add channels r && \ 'r-caret=6.0*' \ 'r-rcurl=1.95*' \ 'r-crayon=1.3*' \ + 'r-plotly=4.5.2*' \ 'r-randomforest=4.6*' && conda clean -tipsy From cec52a045e343debfb37bf9e17f7ad23853c553b Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Mar 2017 00:17:59 +0800 Subject: [PATCH 07/44] Update requirements.txt Added plotly --- python3-notebook/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/python3-notebook/requirements.txt b/python3-notebook/requirements.txt index 4452444..4743073 100644 --- a/python3-notebook/requirements.txt +++ b/python3-notebook/requirements.txt @@ -3,3 +3,4 @@ pandas matplotlib scipy scikit-learn +plotly From 1b8b498b5ccc6b2e8c87dc5452686ef88e185eb1 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Mar 2017 00:58:22 +0800 Subject: [PATCH 08/44] Update Dockerfile updated with bioconda and r-plotly --- r-notebook/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index 7f92b93..30c62f8 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -33,5 +33,6 @@ RUN conda config --add channels r && \ 'r-caret=6.0*' \ 'r-rcurl=1.95*' \ 'r-crayon=1.3*' \ - 'r-plotly=4.5.2*' \ + 'bioconda' \ + 'r-plotly' \ 'r-randomforest=4.6*' && conda clean -tipsy From ec4a06c8f04b4dbaf8fc68e4adf8c6cc91ddfccc Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Mar 2017 01:11:13 +0800 Subject: [PATCH 09/44] Update Dockerfile removed plotly as it's failing the build --- r-notebook/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index 30c62f8..ab64a4e 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -33,6 +33,4 @@ RUN conda config --add channels r && \ 'r-caret=6.0*' \ 'r-rcurl=1.95*' \ 'r-crayon=1.3*' \ - 'bioconda' \ - 'r-plotly' \ 'r-randomforest=4.6*' && conda clean -tipsy From be270793581f30dbc7e3dae7f94d706017afbd04 Mon Sep 17 00:00:00 2001 From: Pui Kwan Date: Mon, 13 Mar 2017 20:35:52 +0800 Subject: [PATCH 10/44] Update README with Quay.io explanation Update README with Quay.io explanation --- readme.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index ca07441..3d5fa94 100644 --- a/readme.md +++ b/readme.md @@ -14,14 +14,14 @@ ### What are containers (in the software sense)? -Containers are a virtual operating system that can run applications or processes the same way regardless of the actual host operating system. For example, somebody who has Windows installed on their laptop can: +Containers are a virtual operating system that can run applications or processes the same way regardless of the actual host operating system. For example, somebody who has Windows installed on their laptop can: 1. develop an application within a container -2. pass that container to her project members -3. run the application on their machines regardless of their operating system -4. get the same results from running the application +2. pass that container to her project members +3. run the application on their machines regardless of their operating system +4. get the same results from running the application -We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in this repo. [Insert explanation of quay.io] +We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in a Quay.io repo. [Quay.io](https://quay.io/) is a service that specializes in hosting private Docker repositories. ## Installation @@ -37,7 +37,7 @@ Follow the setup instructions for your flavor of Linux here: https://docs.docker Follow the setup instructions here: https://docs.docker.com/docker-for-mac/install/ -Or if you use Homebrew Cask, +Or if you use Homebrew Cask, ``` $ brew cask install docker From f6bff7e96cb60a21a0f257faaa47ec408cc5ae37 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 13 Mar 2017 22:56:58 +0800 Subject: [PATCH 11/44] Update Dockerfile Add r-plotly RUN conda config --add channels BIMSBbioinfo && \ conda install --quiet --yes \ 'r-plotly=4.5.2' && conda clean -tipsy --- r-notebook/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index ab64a4e..c3ea7aa 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -34,3 +34,7 @@ RUN conda config --add channels r && \ 'r-rcurl=1.95*' \ 'r-crayon=1.3*' \ 'r-randomforest=4.6*' && conda clean -tipsy + +RUN conda config --add channels BIMSBbioinfo && \ + conda install --quiet --yes \ + 'r-plotly=4.5.2' && conda clean -tipsy From 83ebdd6f246fa3db51b06bdeb4c900795f4c6bf4 Mon Sep 17 00:00:00 2001 From: Paul Amazona Date: Tue, 14 Mar 2017 03:35:27 +0800 Subject: [PATCH 12/44] Updated workshop steps --- readme.md | 100 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 19 deletions(-) diff --git a/readme.md b/readme.md index cba2aa8..6e6ca40 100644 --- a/readme.md +++ b/readme.md @@ -2,15 +2,17 @@ - [Introduction](#introduction) - [Installation](#installation) -- [Using Docker](#using-docker) +- [Ensure that Docker is Running](#Ensure-that-Docker-is-Running) +- [Using Python Notebooks](#Using-Docker-for-Python-Notebooks) +- [Using R Notebooks](#Using-Docker-for-R-Notebooks) ## Introduction -*Contain Yourself* provides volunteers of DataKind Singapore a consistent enviroment when working on a project. By containerizing our tools we can be: +*Contain Yourself* provides volunteers of DataKind Singapore a consistent enviroment when working on a project. By containerizing our tools we can: -- inclusive of volunteers who are running Windows/MacOS/Linux -- more productive by reducing frictions in working on different platforms -- reproducible by sending containers with code to our partners, ready to run no matter what environment they're using +- be inclusive of volunteers who are running Windows/MacOS/Linux +- be more productive by reducing frictions in working on different platforms +- maintain reproducibility when sending containers with code to our partners as it's ready to run no matter what environment they're using. ### What are containers (in the software sense)? @@ -21,7 +23,7 @@ Containers are a virtual operating system that can run applications or processes 3. run the application on their machines regardless of their operating system 4. get the same results from running the application -We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in a Quay.io repo. [Quay.io](https://quay.io/) is a service that specializes in hosting private Docker repositories. +We'll be using [Docker](https://www.docker.com/) containers. Docker images for different projects will be hosted in a Quay.io repository. [Quay.io](https://quay.io/) is a service that specializes in building and hosting Docker repositories. ## Installation @@ -29,13 +31,16 @@ We'll be using [Docker](https://www.docker.com/) containers. Docker images for d Follow the setup instructions here: https://docs.docker.com/docker-for-windows/install/ +Note: If your machine doesn't met the requirement for "Docker For Windows", try setting up "Docker Toolbox": +https://docs.docker.com/toolbox/toolbox_install_windows/ + ### ... for Linux Follow the setup instructions for your flavor of Linux here: https://docs.docker.com/engine/installation/linux/ ### ... for MacOS -Follow the setup instructions here: https://docs.docker.com/docker-for-mac/install/ +Follow the setup instructions here: https://store.docker.com/editions/community/docker-ce-desktop-mac Or if you use Homebrew Cask, @@ -43,7 +48,7 @@ Or if you use Homebrew Cask, $ brew cask install docker ``` -## Using Docker +## Ensure that Docker is Running Start running the Docker app. Check that it is running on the command line: @@ -58,12 +63,19 @@ Server Version: 1.13.1 ... ``` -### Jupyter Python Notebook +## Using Docker for Python Notebooks +### Getting a Python Jupyter Notebook Container Image + +There are at least two ways of getting an image: + +- Pulling from a repository (such as quay.io) +- Loading from a file +#### Pulling from a repository You can pull down the image with: ``` -$ docker pull quay.io/dksg/python3-notebook +$ docker pull quay.io/dksg/python3-notebook:1.0.0 ``` Once that finishes downloading, you should see something like: @@ -71,25 +83,54 @@ Once that finishes downloading, you should see something like: ``` $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE -quay.io/dksg/python3-notebook latest f01e49a5a922 3 days ago 2.61 GB +quay.io/dksg/python3-notebook 1.0.0 f01e49a5a922 3 days ago 2.61 GB +``` + +#### Loading from a file +This is an alternative method. Skip this if you already have pulled from a repository successfully. Otherwise, follow the steps below: + +1. Copy the tar file (get this from a DK corelead) to your local directory (e.g. quay.io_SLASH_dksg_SLASH_python3-notebook_1.0.0.tar) +2. In your local directory, run the following docker command: ``` +docker load --input quay.io_SLASH_dksg_SLASH_python3-notebook_1.0.0.tar +``` +3. This will return a loaded image id. +4. Tag the newly added image with the version from the filename by running the following: +``` +docker tag quay.io/dksg/python3-notebook_:1.0.0 + +``` + +### Running a Jupyter Notebook from the pulled/loaded image -Take that `IMAGE ID` and start it up with this command: +Take the `IMAGE ID` from previous step and start it up with this command: ``` docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 ``` +**Note:** /path/to/local/directory should be replaced by **an existing local directory in your laptop.** +This is where your notebooks (.ipynb) will be stored. +e.g. docker run -p 8888:8888 -v /Users/johndoe/datadive:/home/jovyan/work quay.io/dksg/python3-notebook:1.0.0 You will get instructions for link to paste into your browser address box. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100/) -Note: /path/to/local/directory would be the path to the directory in where you store your .ipynb +### Once the notebook is running, you may create a new notebook and try the samples in this tutorial: +https://plot.ly/python/ipython-notebook-tutorial/ + -### Jupyter R Notebook +## Using Docker for R Notebooks +### Getting an R Jupyter Notebook Container Image +There are at least two ways of getting an image: + +- Pulling from a repository (such as quay.io) +- Loading from a file + +#### Pulling from a repository You can pull down the image with: ``` -$ docker pull quay.io/dksg/r-notebook +$ docker pull quay.io/dksg/r-notebook:1.0.1 ``` Once that finishes downloading, you should see something like: @@ -97,15 +138,36 @@ Once that finishes downloading, you should see something like: ``` $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE -quay.io/dksg/r-notebook latest 0fd93ce8a437 3 days ago 2.63 GB +quay.io/dksg/r-notebook 1.0.1 f01e49a5a922 3 days ago 2.61 GB ``` -Take that `IMAGE ID` and start it up with this command: +#### Loading from a file +This is an alternative method. Skip this if you already have pulled from a repository successfully. Otherwise, follow the steps below: + +1. Copy the tar file (get this from a DK corelead) to your local directory (e.g. quay.io_SLASH_dksg_SLASH_r-notebook_1.0.1.tar) +2. In your local directory, run the following docker command: +``` +docker load --input quay.io_SLASH_dksg_SLASH_r-notebook_1.0.1.tar +``` +3. This will return a loaded image id. +4. Tag the newly added image with the version from the filename by running the following: +``` +docker tag quay.io/dksg/r-notebook:1.0.1 ``` -docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work 0fd93ce8a437 + +### Running a Jupyter Notebook from the pulled/loaded image + +Take the `IMAGE ID` from previous step and start it up with this command: + +``` +docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 ``` +**Note:** /path/to/local/directory should be replaced by **an existing local directory in your laptop.** +This is where your notebooks (.ipynb) will be stored. +e.g. docker run -p 8888:8888 -v /Users/johndoe/datadive:/home/jovyan/work quay.io/dksg/r-notebook:1.0.1 You will get instructions for link to paste into your browser address box. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100/) -Note: /path/to/local/directory would be the path to the directory in where you store your .ipynb +### Once the notebook is running, you may create a new notebook and try the following samples: +https://plot.ly/r/using-r-in-jupyter-notebooks/#examples From ce842342387a5f85a7a9f0fb2b31a1d75ce342fd Mon Sep 17 00:00:00 2001 From: Paul Amazona Date: Tue, 14 Mar 2017 03:40:32 +0800 Subject: [PATCH 13/44] Updated hyperlinks --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 6e6ca40..734cde6 100644 --- a/readme.md +++ b/readme.md @@ -2,9 +2,9 @@ - [Introduction](#introduction) - [Installation](#installation) -- [Ensure that Docker is Running](#Ensure-that-Docker-is-Running) -- [Using Python Notebooks](#Using-Docker-for-Python-Notebooks) -- [Using R Notebooks](#Using-Docker-for-R-Notebooks) +- [Ensure that Docker is Running](#ensure-that-docker-is-running) +- [Using Python Notebooks](#using-docker-for-r-notebooks) +- [Using R Notebooks](#using-docker-for-r-notebooks) ## Introduction From f324c3402994a5927664c5c50bc1e9e6654b5c25 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 14 Mar 2017 17:26:18 +0800 Subject: [PATCH 14/44] Update readme.md corrected table of contents link: #using-docker-for-python-notebooks --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 734cde6..dfc3616 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ - [Introduction](#introduction) - [Installation](#installation) - [Ensure that Docker is Running](#ensure-that-docker-is-running) -- [Using Python Notebooks](#using-docker-for-r-notebooks) +- [Using Python Notebooks](#using-docker-for-python-notebooks) - [Using R Notebooks](#using-docker-for-r-notebooks) ## Introduction From 0506d1e70cab829ad441a8d1cb04c95c50e917cb Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 14 Mar 2017 17:39:14 +0800 Subject: [PATCH 15/44] Update readme.md minor updates --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index dfc3616..7b06b30 100644 --- a/readme.md +++ b/readme.md @@ -97,7 +97,7 @@ docker load --input quay.io_SLASH_dksg_SLASH_python3-notebook_1.0.0.tar 3. This will return a loaded image id. 4. Tag the newly added image with the version from the filename by running the following: ``` -docker tag quay.io/dksg/python3-notebook_:1.0.0 +docker tag quay.io/dksg/python3-notebook:1.0.0 ``` From bacad677c04db99a9350108b2418e49c6f8c81cd Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Wed, 15 Mar 2017 09:27:59 +0800 Subject: [PATCH 16/44] add workflow to readme --- readme.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.md b/readme.md index 7b06b30..4df872f 100644 --- a/readme.md +++ b/readme.md @@ -5,6 +5,7 @@ - [Ensure that Docker is Running](#ensure-that-docker-is-running) - [Using Python Notebooks](#using-docker-for-python-notebooks) - [Using R Notebooks](#using-docker-for-r-notebooks) +- [Workflow](#workflow) ## Introduction @@ -171,3 +172,13 @@ You will get instructions for link to paste into your browser address box. If yo ### Once the notebook is running, you may create a new notebook and try the following samples: https://plot.ly/r/using-r-in-jupyter-notebooks/#examples + + +## Workflow + +If there's a python or R library that you need, you can install it in your container, but unless the library is persisted to the image, your scripts that use the library will not run on somebody else's machine. Each project will have a person assigned as a *library curator* and they will be able to include the library in the project's docker image. Workflow should be: + +1. You're puttering along when you realise that you want to add your favourite nlp library. +2. You install it in your container, and try it out. It works great! +3. Show it to your project's curator and convince them that it's a useful library. Their default mode is lazy and they will try to point you to an existing library. You show them the hot shiny feature the one you want has. +4. The curator changes the requirements file in our docker file Github repo, Quay auto-magically builds a new image, and when people need to run your code, they need to use this new image. From e8ff5e280452c117e6a1bff783638523f44ce47a Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Wed, 15 Mar 2017 12:00:07 +0800 Subject: [PATCH 17/44] change workflow to adding new libraries --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 4df872f..bf32077 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ - [Ensure that Docker is Running](#ensure-that-docker-is-running) - [Using Python Notebooks](#using-docker-for-python-notebooks) - [Using R Notebooks](#using-docker-for-r-notebooks) -- [Workflow](#workflow) +- [Adding new libraries](#adding-new-libraries) ## Introduction @@ -174,7 +174,7 @@ You will get instructions for link to paste into your browser address box. If yo https://plot.ly/r/using-r-in-jupyter-notebooks/#examples -## Workflow +## Adding new libraries If there's a python or R library that you need, you can install it in your container, but unless the library is persisted to the image, your scripts that use the library will not run on somebody else's machine. Each project will have a person assigned as a *library curator* and they will be able to include the library in the project's docker image. Workflow should be: From 50ab773e3b95d9e34086b13e208ed6e7a9177178 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 16 Mar 2017 01:16:17 +0800 Subject: [PATCH 18/44] Update readme.md Added note for setup script when running plotly samples: import plotly plotly.offline.init_notebook_mode() # run at the start of every ipython notebook --- readme.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index bf32077..a59ced7 100644 --- a/readme.md +++ b/readme.md @@ -107,7 +107,7 @@ docker tag quay.io/dksg/python3-notebook:1.0.0 Take the `IMAGE ID` from previous step and start it up with this command: ``` -docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 +docker run -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 ``` **Note:** /path/to/local/directory should be replaced by **an existing local directory in your laptop.** This is where your notebooks (.ipynb) will be stored. @@ -118,6 +118,12 @@ You will get instructions for link to paste into your browser address box. If yo ### Once the notebook is running, you may create a new notebook and try the samples in this tutorial: https://plot.ly/python/ipython-notebook-tutorial/ +Note: The following python script may be needed to run first in order to run the above tutorial samples: +``` +import plotly +plotly.offline.init_notebook_mode() # run at the start of every ipython notebook +``` + ## Using Docker for R Notebooks ### Getting an R Jupyter Notebook Container Image @@ -162,7 +168,7 @@ docker tag quay.io/dksg/r-notebook:1.0.1 Take the `IMAGE ID` from previous step and start it up with this command: ``` -docker run -it -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 +docker run -p 8888:8888 -v /path/to/local/directory:/home/jovyan/work f01e49a5a922 ``` **Note:** /path/to/local/directory should be replaced by **an existing local directory in your laptop.** This is where your notebooks (.ipynb) will be stored. From f8c94d8ada7580cbfea35c572c8d5fffda7ca6f7 Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sun, 19 Mar 2017 12:46:48 +0800 Subject: [PATCH 19/44] addresses python library requirements for #6 --- python3-notebook/requirements.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python3-notebook/requirements.txt b/python3-notebook/requirements.txt index 4743073..a0127e8 100644 --- a/python3-notebook/requirements.txt +++ b/python3-notebook/requirements.txt @@ -1,6 +1,6 @@ -numpy -pandas -matplotlib -scipy -scikit-learn -plotly +matplotlib==2.0.0 +numpy==1.12.0 +pandas==0.19.2 +plotly==2.0.5 +scikit-learn==0.18.1 +scipy==0.19.0 From 12d5b4cb5df0009a8d1ca732e8026a38ee4f4f2a Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sun, 19 Mar 2017 13:08:08 +0800 Subject: [PATCH 20/44] tag the base image. Successfully build locally. (#6) --- python3-notebook/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python3-notebook/Dockerfile b/python3-notebook/Dockerfile index b1524ca..a578395 100644 --- a/python3-notebook/Dockerfile +++ b/python3-notebook/Dockerfile @@ -1,4 +1,4 @@ -FROM jupyter/minimal-notebook +FROM jupyter/minimal-notebook:9e056d61b7a5 COPY requirements.txt /tmp/ RUN pip install --requirement /tmp/requirements.txt From 03298a7023cb5fb22c4e710001abc93ed8bd4ba3 Mon Sep 17 00:00:00 2001 From: KSm Date: Sat, 25 Mar 2017 16:03:08 +0800 Subject: [PATCH 21/44] Added spacy to requirements.txt. --- python3-notebook/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/python3-notebook/requirements.txt b/python3-notebook/requirements.txt index a0127e8..d7a0eee 100644 --- a/python3-notebook/requirements.txt +++ b/python3-notebook/requirements.txt @@ -4,3 +4,4 @@ pandas==0.19.2 plotly==2.0.5 scikit-learn==0.18.1 scipy==0.19.0 +spacy==1.7.2 From b938b4495354eaa2edac2982fc32ff3801dced8d Mon Sep 17 00:00:00 2001 From: KSm Date: Sat, 25 Mar 2017 16:17:37 +0800 Subject: [PATCH 22/44] Added scs and spacy --- children-society/python3-notebook/Dockerfile | 6 + children-society/python3-notebook/readme.md | 1 + .../python3-notebook/requirements.txt | 7 ++ children-society/r-notebook/.dockerignore | 2 + children-society/r-notebook/Dockerfile | 40 ++++++ children-society/r-notebook/README.md | 118 ++++++++++++++++++ 6 files changed, 174 insertions(+) create mode 100644 children-society/python3-notebook/Dockerfile create mode 100644 children-society/python3-notebook/readme.md create mode 100644 children-society/python3-notebook/requirements.txt create mode 100644 children-society/r-notebook/.dockerignore create mode 100644 children-society/r-notebook/Dockerfile create mode 100644 children-society/r-notebook/README.md diff --git a/children-society/python3-notebook/Dockerfile b/children-society/python3-notebook/Dockerfile new file mode 100644 index 0000000..a578395 --- /dev/null +++ b/children-society/python3-notebook/Dockerfile @@ -0,0 +1,6 @@ +FROM jupyter/minimal-notebook:9e056d61b7a5 + +COPY requirements.txt /tmp/ +RUN pip install --requirement /tmp/requirements.txt +COPY . /tmp/ + diff --git a/children-society/python3-notebook/readme.md b/children-society/python3-notebook/readme.md new file mode 100644 index 0000000..51fd4c3 --- /dev/null +++ b/children-society/python3-notebook/readme.md @@ -0,0 +1 @@ +Add any Python libraries to requirements.txt and build new image from Dockerfile diff --git a/children-society/python3-notebook/requirements.txt b/children-society/python3-notebook/requirements.txt new file mode 100644 index 0000000..d7a0eee --- /dev/null +++ b/children-society/python3-notebook/requirements.txt @@ -0,0 +1,7 @@ +matplotlib==2.0.0 +numpy==1.12.0 +pandas==0.19.2 +plotly==2.0.5 +scikit-learn==0.18.1 +scipy==0.19.0 +spacy==1.7.2 diff --git a/children-society/r-notebook/.dockerignore b/children-society/r-notebook/.dockerignore new file mode 100644 index 0000000..9dea340 --- /dev/null +++ b/children-society/r-notebook/.dockerignore @@ -0,0 +1,2 @@ +# Documentation +README.md diff --git a/children-society/r-notebook/Dockerfile b/children-society/r-notebook/Dockerfile new file mode 100644 index 0000000..c3ea7aa --- /dev/null +++ b/children-society/r-notebook/Dockerfile @@ -0,0 +1,40 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +FROM jupyter/minimal-notebook + +MAINTAINER Jupyter Project + +USER root + +# R pre-requisites +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + fonts-dejavu \ + gfortran \ + gcc && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER $NB_USER + +# R packages +RUN conda config --add channels r && \ + conda install --quiet --yes \ + 'r-base=3.3.2' \ + 'r-irkernel=0.7*' \ + 'r-plyr=1.8*' \ + 'r-devtools=1.12*' \ + 'r-tidyverse=1.0*' \ + 'r-shiny=0.14*' \ + 'r-rmarkdown=1.2*' \ + 'r-forecast=7.3*' \ + 'r-rsqlite=1.1*' \ + 'r-reshape2=1.4*' \ + 'r-nycflights13=0.2*' \ + 'r-caret=6.0*' \ + 'r-rcurl=1.95*' \ + 'r-crayon=1.3*' \ + 'r-randomforest=4.6*' && conda clean -tipsy + +RUN conda config --add channels BIMSBbioinfo && \ + conda install --quiet --yes \ + 'r-plotly=4.5.2' && conda clean -tipsy diff --git a/children-society/r-notebook/README.md b/children-society/r-notebook/README.md new file mode 100644 index 0000000..41808db --- /dev/null +++ b/children-society/r-notebook/README.md @@ -0,0 +1,118 @@ +![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") + +# Jupyter Notebook R Stack + +## What it Gives You + +* Jupyter Notebook 4.3.x +* Conda R v3.3.x and channel +* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed +* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom +* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` +* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command +* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub +* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) +* Options for a self-signed HTTPS certificate and passwordless `sudo` + +## Basic Use + +The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. + +``` +docker run -it --rm -p 8888:8888 jupyter/r-notebook +``` + +Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. + +## Notebook Options + +The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. + +You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' +``` + +For example, to set the base URL of the notebook server, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path +``` + +For example, to disable all authentication mechanisms (not a recommended practice): + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' +``` + +You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. + +## Docker Options + +You may customize the execution of the Docker container and the command it is running with the following optional arguments. + +* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. +* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) +* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** +* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). + +## SSL Certificates + +You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder:/etc/ssl/notebook \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key + --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt +``` + +Alternatively, you may mount a single PEM file containing both the key and certificate. For example: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.certfile=/etc/ssl/notebook.pem +``` + +In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). + +For additional information about using SSL, see the following: + +* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. +* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. +* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. + + +## Alternative Commands + +### start-singleuser.sh + +[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: + +```python +# Spawn user containers from this image +c.DockerSpawner.container_image = 'jupyter/r-notebook' + +# Have the Spawner override the Docker run command +c.DockerSpawner.extra_create_kwargs.update({ + 'command': '/usr/local/bin/start-singleuser.sh' +}) +``` + +### start.sh + +The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: + +``` +docker run -it --rm jupyter/r-notebook start.sh ipython +``` + +This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. + +### Others + +You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). From 25e8acf7e9c0f021db58593cde9fa02a9e53ed4f Mon Sep 17 00:00:00 2001 From: KSm Date: Sat, 25 Mar 2017 16:24:32 +0800 Subject: [PATCH 23/44] restore base version. --- python3-notebook/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/python3-notebook/requirements.txt b/python3-notebook/requirements.txt index d7a0eee..a0127e8 100644 --- a/python3-notebook/requirements.txt +++ b/python3-notebook/requirements.txt @@ -4,4 +4,3 @@ pandas==0.19.2 plotly==2.0.5 scikit-learn==0.18.1 scipy==0.19.0 -spacy==1.7.2 From b7a4436a245eacece3437d6ad4d09547c0f4773f Mon Sep 17 00:00:00 2001 From: Akilesh Date: Sat, 25 Mar 2017 16:25:17 +0800 Subject: [PATCH 24/44] Added new r-notebook for O'joy --- ojoy/r-notebook/Dockerfile | 40 +++++++++++++ ojoy/r-notebook/README.md | 118 +++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 ojoy/r-notebook/Dockerfile create mode 100644 ojoy/r-notebook/README.md diff --git a/ojoy/r-notebook/Dockerfile b/ojoy/r-notebook/Dockerfile new file mode 100644 index 0000000..c3ea7aa --- /dev/null +++ b/ojoy/r-notebook/Dockerfile @@ -0,0 +1,40 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +FROM jupyter/minimal-notebook + +MAINTAINER Jupyter Project + +USER root + +# R pre-requisites +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + fonts-dejavu \ + gfortran \ + gcc && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER $NB_USER + +# R packages +RUN conda config --add channels r && \ + conda install --quiet --yes \ + 'r-base=3.3.2' \ + 'r-irkernel=0.7*' \ + 'r-plyr=1.8*' \ + 'r-devtools=1.12*' \ + 'r-tidyverse=1.0*' \ + 'r-shiny=0.14*' \ + 'r-rmarkdown=1.2*' \ + 'r-forecast=7.3*' \ + 'r-rsqlite=1.1*' \ + 'r-reshape2=1.4*' \ + 'r-nycflights13=0.2*' \ + 'r-caret=6.0*' \ + 'r-rcurl=1.95*' \ + 'r-crayon=1.3*' \ + 'r-randomforest=4.6*' && conda clean -tipsy + +RUN conda config --add channels BIMSBbioinfo && \ + conda install --quiet --yes \ + 'r-plotly=4.5.2' && conda clean -tipsy diff --git a/ojoy/r-notebook/README.md b/ojoy/r-notebook/README.md new file mode 100644 index 0000000..41808db --- /dev/null +++ b/ojoy/r-notebook/README.md @@ -0,0 +1,118 @@ +![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") + +# Jupyter Notebook R Stack + +## What it Gives You + +* Jupyter Notebook 4.3.x +* Conda R v3.3.x and channel +* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed +* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom +* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` +* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command +* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub +* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) +* Options for a self-signed HTTPS certificate and passwordless `sudo` + +## Basic Use + +The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. + +``` +docker run -it --rm -p 8888:8888 jupyter/r-notebook +``` + +Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. + +## Notebook Options + +The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. + +You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' +``` + +For example, to set the base URL of the notebook server, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path +``` + +For example, to disable all authentication mechanisms (not a recommended practice): + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' +``` + +You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. + +## Docker Options + +You may customize the execution of the Docker container and the command it is running with the following optional arguments. + +* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. +* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) +* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** +* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). + +## SSL Certificates + +You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder:/etc/ssl/notebook \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key + --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt +``` + +Alternatively, you may mount a single PEM file containing both the key and certificate. For example: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.certfile=/etc/ssl/notebook.pem +``` + +In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). + +For additional information about using SSL, see the following: + +* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. +* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. +* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. + + +## Alternative Commands + +### start-singleuser.sh + +[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: + +```python +# Spawn user containers from this image +c.DockerSpawner.container_image = 'jupyter/r-notebook' + +# Have the Spawner override the Docker run command +c.DockerSpawner.extra_create_kwargs.update({ + 'command': '/usr/local/bin/start-singleuser.sh' +}) +``` + +### start.sh + +The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: + +``` +docker run -it --rm jupyter/r-notebook start.sh ipython +``` + +This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. + +### Others + +You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). From 2e2e258d17ab3836fcacc02af99384bfacbaed8d Mon Sep 17 00:00:00 2001 From: "minghao.ong.2014" Date: Sat, 25 Mar 2017 16:27:51 +0800 Subject: [PATCH 25/44] Added Red Cross Blood Program --- redcross-blood-program/python3-notebook/Dockerfile | 6 ++++++ redcross-blood-program/python3-notebook/readme.md | 1 + redcross-blood-program/python3-notebook/requirements.txt | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 redcross-blood-program/python3-notebook/Dockerfile create mode 100644 redcross-blood-program/python3-notebook/readme.md create mode 100644 redcross-blood-program/python3-notebook/requirements.txt diff --git a/redcross-blood-program/python3-notebook/Dockerfile b/redcross-blood-program/python3-notebook/Dockerfile new file mode 100644 index 0000000..a578395 --- /dev/null +++ b/redcross-blood-program/python3-notebook/Dockerfile @@ -0,0 +1,6 @@ +FROM jupyter/minimal-notebook:9e056d61b7a5 + +COPY requirements.txt /tmp/ +RUN pip install --requirement /tmp/requirements.txt +COPY . /tmp/ + diff --git a/redcross-blood-program/python3-notebook/readme.md b/redcross-blood-program/python3-notebook/readme.md new file mode 100644 index 0000000..51fd4c3 --- /dev/null +++ b/redcross-blood-program/python3-notebook/readme.md @@ -0,0 +1 @@ +Add any Python libraries to requirements.txt and build new image from Dockerfile diff --git a/redcross-blood-program/python3-notebook/requirements.txt b/redcross-blood-program/python3-notebook/requirements.txt new file mode 100644 index 0000000..a0127e8 --- /dev/null +++ b/redcross-blood-program/python3-notebook/requirements.txt @@ -0,0 +1,6 @@ +matplotlib==2.0.0 +numpy==1.12.0 +pandas==0.19.2 +plotly==2.0.5 +scikit-learn==0.18.1 +scipy==0.19.0 From fb237061a0a3f34dc51ba079a98c20fb4dcbd4f6 Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Sat, 25 Mar 2017 16:57:33 +0800 Subject: [PATCH 26/44] change readme's for org folders --- children-society/python3-notebook/readme.md | 6 +- children-society/r-notebook/README.md | 119 +----------------- ojoy/r-notebook/README.md | 119 +----------------- .../python3-notebook/readme.md | 6 +- 4 files changed, 16 insertions(+), 234 deletions(-) diff --git a/children-society/python3-notebook/readme.md b/children-society/python3-notebook/readme.md index 51fd4c3..952991e 100644 --- a/children-society/python3-notebook/readme.md +++ b/children-society/python3-notebook/readme.md @@ -1 +1,5 @@ -Add any Python libraries to requirements.txt and build new image from Dockerfile +This folder has the Python notebook docker files for DKSG's work with the Singapore Children's Society. + +Events: + +* April 2017, DataDive diff --git a/children-society/r-notebook/README.md b/children-society/r-notebook/README.md index 41808db..b167f7b 100644 --- a/children-society/r-notebook/README.md +++ b/children-society/r-notebook/README.md @@ -1,118 +1,5 @@ -![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") +This folder has the R notebook docker files for DKSG's work with the Singapore Children's Society. -# Jupyter Notebook R Stack +Events: -## What it Gives You - -* Jupyter Notebook 4.3.x -* Conda R v3.3.x and channel -* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed -* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom -* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` -* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command -* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub -* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) -* Options for a self-signed HTTPS certificate and passwordless `sudo` - -## Basic Use - -The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. - -``` -docker run -it --rm -p 8888:8888 jupyter/r-notebook -``` - -Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. - -## Notebook Options - -The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. - -You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' -``` - -For example, to set the base URL of the notebook server, run the following: - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path -``` - -For example, to disable all authentication mechanisms (not a recommended practice): - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' -``` - -You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. - -## Docker Options - -You may customize the execution of the Docker container and the command it is running with the following optional arguments. - -* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. -* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) -* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** -* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). - -## SSL Certificates - -You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: - -``` -docker run -d -p 8888:8888 \ - -v /some/host/folder:/etc/ssl/notebook \ - jupyter/r-notebook start-notebook.sh \ - --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key - --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt -``` - -Alternatively, you may mount a single PEM file containing both the key and certificate. For example: - -``` -docker run -d -p 8888:8888 \ - -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ - jupyter/r-notebook start-notebook.sh \ - --NotebookApp.certfile=/etc/ssl/notebook.pem -``` - -In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). - -For additional information about using SSL, see the following: - -* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. -* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. -* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. - - -## Alternative Commands - -### start-singleuser.sh - -[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: - -```python -# Spawn user containers from this image -c.DockerSpawner.container_image = 'jupyter/r-notebook' - -# Have the Spawner override the Docker run command -c.DockerSpawner.extra_create_kwargs.update({ - 'command': '/usr/local/bin/start-singleuser.sh' -}) -``` - -### start.sh - -The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: - -``` -docker run -it --rm jupyter/r-notebook start.sh ipython -``` - -This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. - -### Others - -You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). +* April 2017, DataDive diff --git a/ojoy/r-notebook/README.md b/ojoy/r-notebook/README.md index 41808db..5e5e2f9 100644 --- a/ojoy/r-notebook/README.md +++ b/ojoy/r-notebook/README.md @@ -1,118 +1,5 @@ -![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") +This folder has the R notebook docker files for DKSG's work with the O'Joy. -# Jupyter Notebook R Stack +Events: -## What it Gives You - -* Jupyter Notebook 4.3.x -* Conda R v3.3.x and channel -* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed -* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom -* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` -* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command -* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub -* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) -* Options for a self-signed HTTPS certificate and passwordless `sudo` - -## Basic Use - -The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. - -``` -docker run -it --rm -p 8888:8888 jupyter/r-notebook -``` - -Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. - -## Notebook Options - -The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. - -You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' -``` - -For example, to set the base URL of the notebook server, run the following: - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path -``` - -For example, to disable all authentication mechanisms (not a recommended practice): - -``` -docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' -``` - -You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. - -## Docker Options - -You may customize the execution of the Docker container and the command it is running with the following optional arguments. - -* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. -* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) -* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** -* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). - -## SSL Certificates - -You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: - -``` -docker run -d -p 8888:8888 \ - -v /some/host/folder:/etc/ssl/notebook \ - jupyter/r-notebook start-notebook.sh \ - --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key - --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt -``` - -Alternatively, you may mount a single PEM file containing both the key and certificate. For example: - -``` -docker run -d -p 8888:8888 \ - -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ - jupyter/r-notebook start-notebook.sh \ - --NotebookApp.certfile=/etc/ssl/notebook.pem -``` - -In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). - -For additional information about using SSL, see the following: - -* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. -* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. -* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. - - -## Alternative Commands - -### start-singleuser.sh - -[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: - -```python -# Spawn user containers from this image -c.DockerSpawner.container_image = 'jupyter/r-notebook' - -# Have the Spawner override the Docker run command -c.DockerSpawner.extra_create_kwargs.update({ - 'command': '/usr/local/bin/start-singleuser.sh' -}) -``` - -### start.sh - -The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: - -``` -docker run -it --rm jupyter/r-notebook start.sh ipython -``` - -This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. - -### Others - -You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). +* April 2017, DataDive diff --git a/redcross-blood-program/python3-notebook/readme.md b/redcross-blood-program/python3-notebook/readme.md index 51fd4c3..c672989 100644 --- a/redcross-blood-program/python3-notebook/readme.md +++ b/redcross-blood-program/python3-notebook/readme.md @@ -1 +1,5 @@ -Add any Python libraries to requirements.txt and build new image from Dockerfile +This folder has the Python notebook docker files for DKSG's work with the Red Cross Blood Programme. + +Events: + +* April 2017, DataDive From 89ac49c279501afd2a55f7dcc219654a13147360 Mon Sep 17 00:00:00 2001 From: rwchan13 Date: Mon, 3 Apr 2017 22:47:56 +0800 Subject: [PATCH 27/44] Dockerfile --- ojoy/rstudio | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ojoy/rstudio diff --git a/ojoy/rstudio b/ojoy/rstudio new file mode 100644 index 0000000..553b8f0 --- /dev/null +++ b/ojoy/rstudio @@ -0,0 +1,3 @@ +FROM rocker/rstudio + +RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr"))' From d4bcf4dd1af5509d22143b1f6d9509b41874e90c Mon Sep 17 00:00:00 2001 From: "minghao.ong.2014" Date: Tue, 4 Apr 2017 23:34:50 +0800 Subject: [PATCH 28/44] added r notebook to redcross --- .../r-notebook/.dockerignore | 2 + redcross-blood-program/r-notebook/Dockerfile | 40 ++++++ redcross-blood-program/r-notebook/README.md | 118 ++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 redcross-blood-program/r-notebook/.dockerignore create mode 100644 redcross-blood-program/r-notebook/Dockerfile create mode 100644 redcross-blood-program/r-notebook/README.md diff --git a/redcross-blood-program/r-notebook/.dockerignore b/redcross-blood-program/r-notebook/.dockerignore new file mode 100644 index 0000000..9dea340 --- /dev/null +++ b/redcross-blood-program/r-notebook/.dockerignore @@ -0,0 +1,2 @@ +# Documentation +README.md diff --git a/redcross-blood-program/r-notebook/Dockerfile b/redcross-blood-program/r-notebook/Dockerfile new file mode 100644 index 0000000..c3ea7aa --- /dev/null +++ b/redcross-blood-program/r-notebook/Dockerfile @@ -0,0 +1,40 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +FROM jupyter/minimal-notebook + +MAINTAINER Jupyter Project + +USER root + +# R pre-requisites +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + fonts-dejavu \ + gfortran \ + gcc && apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER $NB_USER + +# R packages +RUN conda config --add channels r && \ + conda install --quiet --yes \ + 'r-base=3.3.2' \ + 'r-irkernel=0.7*' \ + 'r-plyr=1.8*' \ + 'r-devtools=1.12*' \ + 'r-tidyverse=1.0*' \ + 'r-shiny=0.14*' \ + 'r-rmarkdown=1.2*' \ + 'r-forecast=7.3*' \ + 'r-rsqlite=1.1*' \ + 'r-reshape2=1.4*' \ + 'r-nycflights13=0.2*' \ + 'r-caret=6.0*' \ + 'r-rcurl=1.95*' \ + 'r-crayon=1.3*' \ + 'r-randomforest=4.6*' && conda clean -tipsy + +RUN conda config --add channels BIMSBbioinfo && \ + conda install --quiet --yes \ + 'r-plotly=4.5.2' && conda clean -tipsy diff --git a/redcross-blood-program/r-notebook/README.md b/redcross-blood-program/r-notebook/README.md new file mode 100644 index 0000000..41808db --- /dev/null +++ b/redcross-blood-program/r-notebook/README.md @@ -0,0 +1,118 @@ +![docker pulls](https://img.shields.io/docker/pulls/jupyter/r-notebook.svg) ![docker stars](https://img.shields.io/docker/stars/jupyter/r-notebook.svg) [![](https://images.microbadger.com/badges/image/jupyter/r-notebook.svg)](https://microbadger.com/images/jupyter/r-notebook "jupyter/r-notebook image metadata") + +# Jupyter Notebook R Stack + +## What it Gives You + +* Jupyter Notebook 4.3.x +* Conda R v3.3.x and channel +* plyr, devtools, shiny, rmarkdown, forecast, rsqlite, reshape2, nycflights13, caret, rcurl, and randomforest pre-installed +* The [tidyverse](https://github.com/tidyverse/tidyverse) R packages are also installed, including ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, lubridate, and broom +* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda` +* [tini](https://github.com/krallin/tini) as the container entrypoint and [start-notebook.sh](../base-notebook/start-notebook.sh) as the default command +* A [start-singleuser.sh](../base-notebook/start-singleuser.sh) script useful for running a single-user instance of the Notebook server, as required by JupyterHub +* A [start.sh](../base-notebook/start.sh) script useful for running alternative commands in the container (e.g. `ipython`, `jupyter kernelgateway`, `jupyter lab`) +* Options for a self-signed HTTPS certificate and passwordless `sudo` + +## Basic Use + +The following command starts a container with the Notebook server listening for HTTP connections on port 8888 with a randomly generated authentication token configured. + +``` +docker run -it --rm -p 8888:8888 jupyter/r-notebook +``` + +Take note of the authentication token included in the notebook startup log messages. Include it in the URL you visit to access the Notebook server or enter it in the Notebook login form. + +## Notebook Options + +The Docker container executes a [`start-notebook.sh` script](../base-notebook/start-notebook.sh) script by default. The `start-notebook.sh` script handles the `NB_UID` and `GRANT_SUDO` features documented in the next section, and then executes the `jupyter notebook`. + +You can pass [Jupyter command line options](https://jupyter.readthedocs.io/en/latest/projects/jupyter-command.html) through the `start-notebook.sh` script when launching the container. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e' +``` + +For example, to set the base URL of the notebook server, run the following: + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.base_url=/some/path +``` + +For example, to disable all authentication mechanisms (not a recommended practice): + +``` +docker run -d -p 8888:8888 jupyter/r-notebook start-notebook.sh --NotebookApp.token='' +``` + +You can sidestep the `start-notebook.sh` script and run your own commands in the container. See the *Alternative Commands* section later in this document for more information. + +## Docker Options + +You may customize the execution of the Docker container and the command it is running with the following optional arguments. + +* `-e GEN_CERT=yes` - Generates a self-signed SSL certificate and configures Jupyter Notebook to use it to accept encrypted HTTPS connections. +* `-e NB_UID=1000` - Specify the uid of the `jovyan` user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adjusting the user id.) +* `-e GRANT_SUDO=yes` - Gives the `jovyan` user passwordless `sudo` capability. Useful for installing OS packages. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su jovyan` after adding `jovyan` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** +* `-v /some/host/folder/for/work:/home/jovyan/work` - Host mounts the default working directory on the host to preserve work even when the container is destroyed and recreated (e.g., during an upgrade). + +## SSL Certificates + +You may mount SSL key and certificate files into a container and configure Jupyter Notebook to use them to accept HTTPS connections. For example, to mount a host folder containing a `notebook.key` and `notebook.crt`: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder:/etc/ssl/notebook \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.keyfile=/etc/ssl/notebook/notebook.key + --NotebookApp.certfile=/etc/ssl/notebook/notebook.crt +``` + +Alternatively, you may mount a single PEM file containing both the key and certificate. For example: + +``` +docker run -d -p 8888:8888 \ + -v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \ + jupyter/r-notebook start-notebook.sh \ + --NotebookApp.certfile=/etc/ssl/notebook.pem +``` + +In either case, Jupyter Notebook expects the key and certificate to be a base64 encoded text file. The certificate file or PEM may contain one or more certificates (e.g., server, intermediate, and root). + +For additional information about using SSL, see the following: + +* The [docker-stacks/examples](https://github.com/jupyter/docker-stacks/tree/master/examples) for information about how to use [Let's Encrypt](https://letsencrypt.org/) certificates when you run these stacks on a publicly visible domain. +* The [jupyter_notebook_config.py](jupyter_notebook_config.py) file for how this Docker image generates a self-signed certificate. +* The [Jupyter Notebook documentation](https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication) for best practices about running a public notebook server in general, most of which are encoded in this image. + + +## Alternative Commands + +### start-singleuser.sh + +[JupyterHub](https://jupyterhub.readthedocs.io) requires a single-user instance of the Jupyter Notebook server per user. To use this stack with JupyterHub and [DockerSpawner](https://github.com/jupyter/dockerspawner), you must specify the container image name and override the default container run command in your `jupyterhub_config.py`: + +```python +# Spawn user containers from this image +c.DockerSpawner.container_image = 'jupyter/r-notebook' + +# Have the Spawner override the Docker run command +c.DockerSpawner.extra_create_kwargs.update({ + 'command': '/usr/local/bin/start-singleuser.sh' +}) +``` + +### start.sh + +The `start.sh` script supports the same features as the default `start-notebook.sh` script (e.g., `GRANT_SUDO`), but allows you to specify an arbitrary command to execute. For example, to run the text-based `ipython` console in a container, do the following: + +``` +docker run -it --rm jupyter/r-notebook start.sh ipython +``` + +This script is particularly useful when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, and `jupyter lab`. + +### Others + +You can bypass the provided scripts and specify your an arbitrary start command. If you do, keep in mind that certain features documented above will not function (e.g., `GRANT_SUDO`). From 73d351b77e8c84a80864a90718a762d6f6e53174 Mon Sep 17 00:00:00 2001 From: rwchan13 Date: Wed, 5 Apr 2017 08:05:43 +0800 Subject: [PATCH 29/44] Delete rstudio --- ojoy/rstudio | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 ojoy/rstudio diff --git a/ojoy/rstudio b/ojoy/rstudio deleted file mode 100644 index 553b8f0..0000000 --- a/ojoy/rstudio +++ /dev/null @@ -1,3 +0,0 @@ -FROM rocker/rstudio - -RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr"))' From 06ea156f6422cdc27c04a27c016810e5e8b4ab87 Mon Sep 17 00:00:00 2001 From: rwchan13 Date: Wed, 5 Apr 2017 08:12:04 +0800 Subject: [PATCH 30/44] Create Dockerfile --- ojoy/rstudio/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ojoy/rstudio/Dockerfile diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile new file mode 100644 index 0000000..fc7eb8d --- /dev/null +++ b/ojoy/rstudio/Dockerfile @@ -0,0 +1,3 @@ +FROM rocker/rstudio + +RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr"))' From 18409a130ffc233a051c46273d0dda0c17654890 Mon Sep 17 00:00:00 2001 From: Akilesh Date: Thu, 6 Apr 2017 00:30:42 +0800 Subject: [PATCH 31/44] Added shiny and data.table libraries --- ojoy/rstudio/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index fc7eb8d..65d3809 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,3 +1,3 @@ FROM rocker/rstudio -RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr"))' +RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"))' From 2a9017b2400ee77df5695541e592c0c4dd9b7b18 Mon Sep 17 00:00:00 2001 From: KSm Date: Thu, 6 Apr 2017 23:44:32 +0800 Subject: [PATCH 32/44] Add tag to r-notebook base image in Dockerfile --- children-society/r-notebook/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/children-society/r-notebook/Dockerfile b/children-society/r-notebook/Dockerfile index c3ea7aa..aeaa04f 100644 --- a/children-society/r-notebook/Dockerfile +++ b/children-society/r-notebook/Dockerfile @@ -1,6 +1,6 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -FROM jupyter/minimal-notebook +FROM jupyter/minimal-notebook:9e056d61b7a5 MAINTAINER Jupyter Project From 1853b6ab63cab173acf1167a6fd52c7bc836da52 Mon Sep 17 00:00:00 2001 From: Akilesh Date: Fri, 7 Apr 2017 00:35:01 +0800 Subject: [PATCH 33/44] Modified FROM in R-notebook to FROM jupyter/minimal-notebook:9e056d61b7a5 --- ojoy/rstudio/Dockerfile | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index 65d3809..9bd6f48 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,3 +1,30 @@ -FROM rocker/rstudio - -RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"))' +FROM rocker/rstudio:3.3.3 + +#METHOD 1 +#RUN wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz +#RUN R CMD INSTALL ggplot2_0.9.1.tar.gz +#RUN R -e "install.packages("ggplot2",version = “2.2.1”,repos = "http://cran.us.r-project.org")" +#RUN R -e "install.packages("dplyr",version = “0.5.0”,repos = 'http://cran.us.r-project.org')" +#RUN R -e "install.packages("tidyr",version = “0.6.1”,repos = 'http://cran.us.r-project.org')" +#RUN R -e "install.packages("data.table",version = "1.10.4",repos = 'http://cran.us.r-project.org')" +#RUN R -e "install.packages("shiny",version = "1.0.1",repos = 'http://cran.us.r-project.org')" +#RUN R -e "install.packages(c('ggplot2', 'dplyr'), c('2.2.1', '0.5.0'))" +#RUN R -e 'install.versions(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"), c("2.2.1", "0.5.0", "0.6.1", "1.10.4", "1.0.1"))' + +#METHOD 2 +#RUN require(devtools) +#RUN install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org") + +#METHOD 3 --> THIS ACTUALLY WORKS BUT IS ASKING FOR SOME DEPENDENCY LIBRARIES +#RUN wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz +#RUN R CMD INSTALL ggplot2_0.9.1.tar.gz + +#TRY 4 +#RUN R -e 'install.packages(c('ggplot2', 'dplyr', 'tidyr', 'data.table', 'shiny'),c('2.2.1', '0.5.0', '0.6.1', '1.10.4', '1.0.1'))' + +#TRY 5 +#RUN R -e 'install.version('ggplot2',version='2.2.1',repos = 'http://cran.us.r-project.org')' + +#TRY 6 +#RUN echo 'install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))' + From 6695d25718901f06d81860722fd325080b3f123c Mon Sep 17 00:00:00 2001 From: Akilesh Date: Fri, 7 Apr 2017 00:38:57 +0800 Subject: [PATCH 34/44] Reverted rstudio dockerfile to original code --- ojoy/rstudio/Dockerfile | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index 9bd6f48..9578d8d 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,30 +1,3 @@ -FROM rocker/rstudio:3.3.3 - -#METHOD 1 -#RUN wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz -#RUN R CMD INSTALL ggplot2_0.9.1.tar.gz -#RUN R -e "install.packages("ggplot2",version = “2.2.1”,repos = "http://cran.us.r-project.org")" -#RUN R -e "install.packages("dplyr",version = “0.5.0”,repos = 'http://cran.us.r-project.org')" -#RUN R -e "install.packages("tidyr",version = “0.6.1”,repos = 'http://cran.us.r-project.org')" -#RUN R -e "install.packages("data.table",version = "1.10.4",repos = 'http://cran.us.r-project.org')" -#RUN R -e "install.packages("shiny",version = "1.0.1",repos = 'http://cran.us.r-project.org')" -#RUN R -e "install.packages(c('ggplot2', 'dplyr'), c('2.2.1', '0.5.0'))" -#RUN R -e 'install.versions(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"), c("2.2.1", "0.5.0", "0.6.1", "1.10.4", "1.0.1"))' - -#METHOD 2 -#RUN require(devtools) -#RUN install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org") - -#METHOD 3 --> THIS ACTUALLY WORKS BUT IS ASKING FOR SOME DEPENDENCY LIBRARIES -#RUN wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz -#RUN R CMD INSTALL ggplot2_0.9.1.tar.gz - -#TRY 4 -#RUN R -e 'install.packages(c('ggplot2', 'dplyr', 'tidyr', 'data.table', 'shiny'),c('2.2.1', '0.5.0', '0.6.1', '1.10.4', '1.0.1'))' - -#TRY 5 -#RUN R -e 'install.version('ggplot2',version='2.2.1',repos = 'http://cran.us.r-project.org')' - -#TRY 6 -#RUN echo 'install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))' - +FROM rocker/rstudio + +RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"))' \ No newline at end of file From a87544c4b817f1d473dc960c7bcc4e19d0d61e11 Mon Sep 17 00:00:00 2001 From: Akilesh Date: Fri, 7 Apr 2017 00:40:43 +0800 Subject: [PATCH 35/44] Modified FROM in R-notebook to FROM jupyter/minimal-notebook:9e056d61b7a5 --- ojoy/r-notebook/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ojoy/r-notebook/Dockerfile b/ojoy/r-notebook/Dockerfile index c3ea7aa..aeaa04f 100644 --- a/ojoy/r-notebook/Dockerfile +++ b/ojoy/r-notebook/Dockerfile @@ -1,6 +1,6 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -FROM jupyter/minimal-notebook +FROM jupyter/minimal-notebook:9e056d61b7a5 MAINTAINER Jupyter Project From a207589d9deae8a71dee9946b979df43c0aa008d Mon Sep 17 00:00:00 2001 From: rwchan13 Date: Fri, 7 Apr 2017 08:05:46 +0800 Subject: [PATCH 36/44] Now the versions. --- ojoy/rstudio/Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index 65d3809..a4a5fec 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,3 +1,9 @@ -FROM rocker/rstudio - -RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"))' +FROM rocker/rstudio + +RUN R -e 'install.packages("devtools"); \ + library(devtools); \ + install_version("ggplot2", "2.2.1"); \ + install_version("dplyr", "0.5.0"); \ + install_version("tidyr", "0.6.1"); \ + install_version("data.table", "1.10.4"); \ + install_version("shiny", "1.0.1");' From 8cdbd837cd08ebbf58177114bcc1904e75732eda Mon Sep 17 00:00:00 2001 From: oliverxchen Date: Fri, 7 Apr 2017 09:00:43 +0800 Subject: [PATCH 37/44] from my phone! --- ojoy/rstudio/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index a4a5fec..40483ae 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,9 +1,9 @@ -FROM rocker/rstudio +FROM rocker/rstudio:3.3.3 RUN R -e 'install.packages("devtools"); \ library(devtools); \ - install_version("ggplot2", "2.2.1"); \ - install_version("dplyr", "0.5.0"); \ - install_version("tidyr", "0.6.1"); \ - install_version("data.table", "1.10.4"); \ - install_version("shiny", "1.0.1");' + install_version("ggplot2", "2.2.1", repos = "https://cloud.r-project.org/"); \ + install_version("dplyr", "0.5.0", repos = "https://cloud.r-project.org/"); \ + install_version("tidyr", "0.6.1", repos = "https://cloud.r-project.org/"); \ + install_version("data.table", "1.10.4", repos = "https://cloud.r-project.org/"); \ + install_version("shiny", "1.0.1", repos = "https://cloud.r-project.org/");' From 1821d435db656f6274e8f038e774f24d9486818c Mon Sep 17 00:00:00 2001 From: "minghao.ong.2014" Date: Fri, 7 Apr 2017 10:56:10 +0800 Subject: [PATCH 38/44] modified dockerfile --- redcross-blood-program/r-notebook/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redcross-blood-program/r-notebook/Dockerfile b/redcross-blood-program/r-notebook/Dockerfile index c3ea7aa..aeaa04f 100644 --- a/redcross-blood-program/r-notebook/Dockerfile +++ b/redcross-blood-program/r-notebook/Dockerfile @@ -1,6 +1,6 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -FROM jupyter/minimal-notebook +FROM jupyter/minimal-notebook:9e056d61b7a5 MAINTAINER Jupyter Project From 85a3002588d1942ecf7ff35e0d7d3b373c7f13e8 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 7 Apr 2017 14:06:08 +0800 Subject: [PATCH 39/44] Added RStudio info in readme --- readme.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/readme.md b/readme.md index a59ced7..2c2df3e 100644 --- a/readme.md +++ b/readme.md @@ -5,6 +5,7 @@ - [Ensure that Docker is Running](#ensure-that-docker-is-running) - [Using Python Notebooks](#using-docker-for-python-notebooks) - [Using R Notebooks](#using-docker-for-r-notebooks) +- [Using RStudio](#using-docker-for-rstudio) - [Adding new libraries](#adding-new-libraries) ## Introduction @@ -180,6 +181,61 @@ You will get instructions for link to paste into your browser address box. If yo https://plot.ly/r/using-r-in-jupyter-notebooks/#examples +## Using Docker for RStudio +### Getting an RStudio Container Image + +There are at least two ways of getting an image: + +- Pulling from a repository (such as quay.io) +- Loading from a file + +#### Pulling from a repository +You can pull down the image with: + +``` +$ docker pull quay.io/dksg/ojoy-rstudio:1.0.2 +``` + +Once that finishes downloading, you should see something like: + +``` +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +quay.io/dksg/ojoy-rstudio 1.0.2 1c1e06209032 13 hours ago 1.166 GB +``` + +#### Loading from a file +This is an alternative method. Skip this if you already have pulled from a repository successfully. Otherwise, follow the steps below: + +1. Copy the tar file (get this from a DK corelead) to your local directory (e.g. quay.io_SLASH_dksg_SLASH_ojoy-rstudio_1.0.2.tar) +2. In your local directory, run the following docker command: +``` +docker load --input quay.io_SLASH_dksg_SLASH_ojoy-rstudio_1.0.2.tar +``` +3. Once loaded, you should be able to see the new image when you run "docker images": +``` +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +quay.io/dksg/ojoy-rstudio 1.0.2 1c1e06209032 13 hours ago 1.166 GB +``` + + +### Running a RStudio from the pulled/loaded image + +Start it up with this command: + +``` +docker run -p 8787:8787 -v /path/to/local/directory:/home/rstudio/foobar quay.io/dksg/ojoy-rstudio:1.0.2 +``` +**Note:** /path/to/local/directory should be replaced by **an existing local directory in your laptop.** +This is where your data/scripts will be stored. +e.g. docker run -d -p 8787:8787 -v /Users/johndoe/datadive:/home/rstudio/foobar quay.io/dksg/ojoy-rstudio:1.0.2 + +You should be able to access RStudio in the browser via http://localhost:8787. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100:8787) +Username: rstudio +Password: rstudio + + ## Adding new libraries If there's a python or R library that you need, you can install it in your container, but unless the library is persisted to the image, your scripts that use the library will not run on somebody else's machine. Each project will have a person assigned as a *library curator* and they will be able to include the library in the project's docker image. Workflow should be: From b5198700e9599b76ccd491391933926bcc570ccb Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 7 Apr 2017 14:07:50 +0800 Subject: [PATCH 40/44] Rstudio info in readme - corrected typo --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2c2df3e..e7eb8df 100644 --- a/readme.md +++ b/readme.md @@ -220,7 +220,7 @@ quay.io/dksg/ojoy-rstudio 1.0.2 1c1e06209032 1 ``` -### Running a RStudio from the pulled/loaded image +### Running RStudio from the pulled/loaded image Start it up with this command: From 81e7c9c7e2e5d500f50a2a62eb8a2c4d1d55137b Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 7 Apr 2017 14:09:00 +0800 Subject: [PATCH 41/44] rstudio in readme - cosmetic touch --- readme.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index e7eb8df..d3bbc70 100644 --- a/readme.md +++ b/readme.md @@ -231,8 +231,10 @@ docker run -p 8787:8787 -v /path/to/local/directory:/home/rstudio/foobar quay.io This is where your data/scripts will be stored. e.g. docker run -d -p 8787:8787 -v /Users/johndoe/datadive:/home/rstudio/foobar quay.io/dksg/ojoy-rstudio:1.0.2 -You should be able to access RStudio in the browser via http://localhost:8787. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100:8787) -Username: rstudio +You should be able to access RStudio in the browser via http://localhost:8787. If you're using Docker Toolbox, you should use the custom IP address (default http://192.168.99.100:8787) + +Username: rstudio + Password: rstudio From ac0c62190ad01b2dcafe3ba4cc654c7efcb35481 Mon Sep 17 00:00:00 2001 From: "minghao.ong.2014" Date: Fri, 7 Apr 2017 19:13:22 +0800 Subject: [PATCH 42/44] added folium to red cross python notebook --- redcross-blood-program/python3-notebook/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/redcross-blood-program/python3-notebook/requirements.txt b/redcross-blood-program/python3-notebook/requirements.txt index a0127e8..f409450 100644 --- a/redcross-blood-program/python3-notebook/requirements.txt +++ b/redcross-blood-program/python3-notebook/requirements.txt @@ -4,3 +4,4 @@ pandas==0.19.2 plotly==2.0.5 scikit-learn==0.18.1 scipy==0.19.0 +folium==0.3.0 From d0d926ce0aa7590f82cb38fc5ed5e3cd58fb3830 Mon Sep 17 00:00:00 2001 From: "minghao.ong.2014" Date: Sat, 8 Apr 2017 09:14:30 +0800 Subject: [PATCH 43/44] add geopy lib --- redcross-blood-program/python3-notebook/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/redcross-blood-program/python3-notebook/requirements.txt b/redcross-blood-program/python3-notebook/requirements.txt index f409450..f025e1b 100644 --- a/redcross-blood-program/python3-notebook/requirements.txt +++ b/redcross-blood-program/python3-notebook/requirements.txt @@ -5,3 +5,4 @@ plotly==2.0.5 scikit-learn==0.18.1 scipy==0.19.0 folium==0.3.0 +geopy==1.11.0 From 8b5ff919764b529a6cf0f85f7b453446dd182dcc Mon Sep 17 00:00:00 2001 From: Akilesh Date: Sat, 8 Apr 2017 13:29:30 +0800 Subject: [PATCH 44/44] Added each library as a layer to pull images faster,added two libraries leaflet and vcd --- ojoy/rstudio/Dockerfile | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/ojoy/rstudio/Dockerfile b/ojoy/rstudio/Dockerfile index 9578d8d..db892cf 100644 --- a/ojoy/rstudio/Dockerfile +++ b/ojoy/rstudio/Dockerfile @@ -1,3 +1,26 @@ -FROM rocker/rstudio - -RUN R -e 'install.packages(c("ggplot2", "dplyr", "tidyr", "data.table", "shiny"))' \ No newline at end of file +FROM rocker/rstudio:3.3.3 + +RUN R -e 'install.packages("devtools")' + + +RUN R -e 'library(devtools); \ + install_version("ggplot2", "2.2.1");' + + +RUN R -e 'library(devtools); \ + install_version("dplyr", "0.5.0");' + +RUN R -e 'library(devtools); \ + install_version("tidyr", "0.6.1");' + +RUN R -e 'library(devtools); \ + install_version("data.table", "1.10.4");' + +RUN R -e 'library(devtools); \ + install_version("leaflet", "1.1.0");' + +RUN R -e 'library(devtools); \ + install_version("shiny", "1.0.1", repos = "https://cloud.r-project.org/");' + +RUN R -e 'library(devtools); \ + install_version("vcd", "1.4-3");' \ No newline at end of file