Merge pull request #11 from minrk/configurable-home

allow configuring the notebook directory
This commit is contained in:
Carol Willing 2016-05-12 08:57:40 -07:00
commit 31f6ebf073
2 changed files with 8 additions and 2 deletions

5
.env
View File

@ -17,6 +17,11 @@ DOCKER_NETWORK_NAME=jupyterhub-network
# Single-user Jupyter Notebook server container image # Single-user Jupyter Notebook server container image
DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:2d878db5cbff DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:2d878db5cbff
# Notebook directory in the container.
# This will be /home/jovyan/work if the default
# This directory is stored as a docker volume for each user
DOCKER_NOTEBOOK_DIR=/home/jovyan/work
# 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

@ -32,10 +32,11 @@ c.DockerSpawner.extra_start_kwargs = { 'network_mode': network_name }
# it. Most jupyter/docker-stacks *-notebook images run the Notebook server as # it. Most jupyter/docker-stacks *-notebook images run the Notebook server as
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`. # user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
# We follow the same convention. # We follow the same convention.
c.DockerSpawner.notebook_dir = '/home/jovyan/work' notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work'
c.DockerSpawner.notebook_dir = notebook_dir
# Mount the real user's Docker volume on the host to the notebook user's # Mount the real user's Docker volume on the host to the notebook user's
# notebook directory in the container # notebook directory in the container
c.DockerSpawner.volumes = { '{username}': '/home/jovyan/work' } c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }
c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' }) c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' })
# Remove containers once they are stopped # Remove containers once they are stopped
c.DockerSpawner.remove_containers = True c.DockerSpawner.remove_containers = True