allow configuring the notebook directory
Makes it a bit easier if the image isn't based on docker-stacks.
This commit is contained in:
parent
f5453b21a6
commit
9e10f27b38
5
.env
5
.env
@ -17,6 +17,11 @@ DOCKER_NETWORK_NAME=jupyterhub-network
|
||||
# Single-user Jupyter Notebook server container image
|
||||
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_SPAWN_CMD=start-singleuser.sh
|
||||
|
||||
|
@ -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
|
||||
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
|
||||
# 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
|
||||
# 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' })
|
||||
# Remove containers once they are stopped
|
||||
c.DockerSpawner.remove_containers = True
|
||||
|
Loading…
Reference in New Issue
Block a user