Rename DOCKER_CONTAINER_IMAGE => DOCKER_NOTEBOOK_IMAGE

(c) Copyright IBM Corp. 2016
This commit is contained in:
Justin Tyberg 2016-04-19 12:21:46 -04:00
parent d1d5fc4213
commit e1b9f8ed9a
5 changed files with 24 additions and 22 deletions

2
.env
View File

@ -15,7 +15,7 @@ DOCKER_MACHINE_NAME=jupyterhub
DOCKER_NETWORK_NAME=jupyterhub-network DOCKER_NETWORK_NAME=jupyterhub-network
# Single-user Jupyter Notebook server container image # Single-user Jupyter Notebook server container image
DOCKER_CONTAINER_IMAGE=jupyter/scipy-notebook:2d878db5cbff DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:2d878db5cbff
# Docker run command to use when spawning single-user containers # Docker run command to use when spawning single-user containers
DOCKER_SPAWN_CMD=start-singleuser.sh DOCKER_SPAWN_CMD=start-singleuser.sh

View File

@ -178,9 +178,9 @@ docker pull jupyter/scipy-notebook:2d878db5cbff
``` ```
Note: If you choose to use a container image other than Note: If you choose to use a container image other than
``jupyter/scipy-notebook``, you must change the `DOCKER_CONTAINER_IMAGE` value ``jupyter/scipy-notebook``, you must change the `DOCKER_NOTEBOOK_IMAGE` value
of the `.env` file to the desired container image. Alternatively, you can of the `.env` file to the desired container image. Alternatively, you can
override the value by setting the `DOCKER_CONTAINER_IMAGE` variable to a override the value by setting the `DOCKER_NOTEBOOK_IMAGE` variable to a
different Notebook image in the environment where you launch JupyterHub. different Notebook image in the environment where you launch JupyterHub.
## Run the JupyterHub container ## Run the JupyterHub container
@ -219,34 +219,33 @@ docker logs jupyterhub
In this deployment, JupyterHub uses DockerSpawner to spawn single-user In this deployment, JupyterHub uses DockerSpawner to spawn single-user
Notebook servers. You set the desired Notebook server image in a Notebook servers. You set the desired Notebook server image in a
`DOCKER_CONTAINER_IMAGE` environment variable. `DOCKER_NOTEBOOK_IMAGE` environment variable.
When spawning single-user notebooks, JupyterHub reads the DockerSpawner's JupyterHub reads the Notebook image name from `jupyterhub_config.py`, which
image name from `jupyterhub_config.py` file. This file includes the reads the Notebook image name from the `DOCKER_CONTAINER_IMAGE` environment
DockerSpawner's image name which refers to desired image in the variable:
`DOCKER_CONTAINER_IMAGE` environment variable:
``` ```
# DockerSpawner setting in jupyterhub_config.py # DockerSpawner setting in jupyterhub_config.py
c.DockerSpawner.container_image = os.environ['DOCKER_CONTAINER_IMAGE'] c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']
``` ```
By default, the`DOCKER_CONTAINER_IMAGE` environment variable is set in the By default, the`DOCKER_NOTEBOOK_IMAGE` environment variable is set in the
`.env` file. `.env` file.
``` ```
# Setting in the .env file # Setting in the .env file
DOCKER_CONTAINER_IMAGE=jupyter/scipy-notebook:2d878db5cbff DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:2d878db5cbff
``` ```
To use a different notebook server image, you can either change the desired To use a different notebook server image, you can either change the desired
container image value in the `.env` file, or you can override it container image value in the `.env` file, or you can override it
by setting the `DOCKER_CONTAINER_IMAGE` variable to a different Notebook by setting the `DOCKER_NOTEBOOK_IMAGE` variable to a different Notebook
image in the environment where you launch JupyterHub. For example, the image in the environment where you launch JupyterHub. For example, the
following setting would be used to spawn single-user pyspark notebook servers: following setting would be used to spawn single-user `pyspark` notebook servers:
``` ```
DOCKER_CONTAINER_IMAGE=jupyterhub/pyspark-notebook:2d878db5cbff \ DOCKER_NOTEBOOK_IMAGE=jupyterhub/pyspark-notebook:2d878db5cbff \
./hub.sh up -d ./hub.sh up -d
``` ```

View File

@ -30,8 +30,8 @@ services:
DOCKER_TLS_KEY: "/etc/docker/server-key.pem" DOCKER_TLS_KEY: "/etc/docker/server-key.pem"
# All containers will join this network # All containers will join this network
DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME} DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME}
# JupyterHub will spawn this image for users # JupyterHub will spawn this Notebook image for users
DOCKER_CONTAINER_IMAGE: ${DOCKER_CONTAINER_IMAGE} DOCKER_NOTEBOOK_IMAGE: ${DOCKER_NOTEBOOK_IMAGE}
# Using this run command (optional) # Using this run command (optional)
DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD} DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD}
# Required to authenticate users using GitHub OAuth # Required to authenticate users using GitHub OAuth

View File

@ -15,10 +15,13 @@ docker build -t my-custom-notebook .
## Run JupyterHub Container ## Run JupyterHub Container
To have JupyterHub spawn the `my-custom-notebook` image for single-user Notebook servers, set the `DOCKER_CONTAINER_IMAGE` environment variable to the image name when you run the JupyterHub container. For example, run the following **from the root directory** of this repository: To have JupyterHub spawn the `my-custom-notebook` image for single-user Notebook
servers, set the `DOCKER_NOTEBOOK_IMAGE` environment variable to the image name
when you run the JupyterHub container. For example, run the following
**from the root directory** of this repository:
``` ```
export DOCKER_CONTAINER_IMAGE=my-custom-notebook export DOCKER_NOTEBOOK_IMAGE=my-custom-notebook
# bring down the JupyterHub container, if running # bring down the JupyterHub container, if running
./hub.sh down ./hub.sh down

View File

@ -13,7 +13,7 @@ c = get_config()
# Spawn single-user servers as Docker containers # Spawn single-user servers as Docker containers
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner' c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
# Spawn containers from this image # Spawn containers from this image
c.DockerSpawner.container_image = os.environ['DOCKER_CONTAINER_IMAGE'] c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']
# JupyterHub requires a single-user instance of the Notebook server, so we # JupyterHub requires a single-user instance of the Notebook server, so we
# default to using the `start-singleuser.sh` script included in the # default to using the `start-singleuser.sh` script included in the
# jupyter/docker-stacks *-notebook images as the Docker run command when # jupyter/docker-stacks *-notebook images as the Docker run command when