Multiple revisions based on feedback.

Contribution (c) Copyright IBM Corp. 2016
This commit is contained in:
Michael Poplavski
2016-01-12 08:54:24 -06:00
parent 384d524032
commit 943e376fc7
3 changed files with 8 additions and 32 deletions

View File

@@ -12,12 +12,8 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \ build-essential \
python3-dev \ python3-dev \
python3-pip \ python3-pip \
ca-certificates \
bzip2 \
unzip \
libsm6 \ libsm6 \
python3-zmq \ python3-zmq \
sudo \
&& apt-get clean && apt-get clean
# Install Tini # Install Tini
@@ -26,22 +22,15 @@ RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.6.0/tini &
mv tini /usr/local/bin/tini && \ mv tini /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini chmod +x /usr/local/bin/tini
# Configure environment
ENV SHELL /bin/bash
ENV NB_USER nobody
ENV NB_UID 1000
# Install Kernel Gateway # Install Kernel Gateway
RUN pip3 install jupyter_kernel_gateway==0.2.0 RUN pip3 install jupyter_kernel_gateway==0.2.0
# Configure container startup # Configure container startup
USER $NB_USER USER nobody
EXPOSE 8888 EXPOSE 8888
WORKDIR /home/$NB_USER/work WORKDIR /tmp
ENTRYPOINT ["tini", "--", "jupyter", "kernelgateway"] ENTRYPOINT ["tini", "--", "jupyter", "kernelgateway"]
CMD ["--KernelGatewayApp.ip=0.0.0.0"] CMD ["--KernelGatewayApp.ip=0.0.0.0"]
# Add local files as late as possible to avoid cache busting #error Permission denied: '/nonexistent' when not running as root or as user nobody
USER root USER root
COPY jupyter_kernel_gateway_config.py /home/$NB_USER/.jupyter/
RUN chown -R $NB_USER:users /home/$NB_USER/.jupyter

View File

@@ -1,12 +1,9 @@
# Kernel Gateway Stack # Kernel Gateway Stack
## What it Gives You ## What it Gives You
* [Jupyter Kernel Gateway](https://github.com/jupyter-incubator/kernel_gateway) that spawns minimal Jupyter Python kernel * [Jupyter Kernel Gateway](https://github.com/jupyter-incubator/kernel_gateway) that enables programmatic access to kernels
* No preinstalled scientific computing packages * No preinstalled scientific computing packages
* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan`
* [tini](https://github.com/krallin/tini) as the container entrypoint * [tini](https://github.com/krallin/tini) as the container entrypoint
* Options for Port and Ip address
## Basic Use ## Basic Use
@@ -16,9 +13,6 @@ The following command starts a container with the Kernel Gateway server listenin
docker run -d -p 8888:8888 jupyter/minimal-kernel docker run -d -p 8888:8888 jupyter/minimal-kernel
``` ```
## Docker Options ## Docker Options and More Information
* For more information on the Kernel Gateway and its configuration options see the
You may customize the execution of the Docker container and the Notebook server it contains with the following optional arguments. [Kernel Gateway Repository](https://github.com/jupyter-incubator/kernel_gateway#what-it-gives-you).
* `-e INTERFACE=10.10.10.10` - Configures Kernel Gateway to listen on the given interface. Defaults to '0.0.0.0', all interfaces, which is appropriate when running using default bridged Docker networking. When using Docker's `--net=host`, you may wish to use this option to specify a particular network interface.
* `-e PORT=8888` - Configures Kernel Gateway to listen on the given port. Defaults to 8888, which is the port exposed within the Dockerfile for the image. When using Docker's `--net=host`, you may wish to use this option to specify a particular port.

View File

@@ -1,7 +0,0 @@
# Copyright (c) Jupyter Development Team.
import os
c = get_config()
c.KernelGatewayApp.ip = os.getenv('INTERFACE', '') or '0.0.0.0'
c.KernelGatewayApp.port = int(os.getenv('PORT', '') or 8888)