/
jupyterhub_config.py
41 lines (27 loc) · 1.21 KB
/
jupyterhub_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
c = get_config() # noqa
options_form_tpl = """
<label for="image">Image</label>
<input name="image" class="form-control" placeholder="the image to launch (default: {default_image})"></input>
"""
def get_options_form(spawner):
return options_form_tpl.format(default_image=spawner.image)
c.DockerSpawner.options_form = get_options_form
# specify that DockerSpawner should accept any image from user input
c.DockerSpawner.allowed_images = "*"
# tell JupyterHub to use DockerSpawner
c.JupyterHub.spawner_class = "docker"
# the rest of the config is testing boilerplate
# to make the Hub connectable from the containers
# dummy for testing. Don't use this in production!
c.JupyterHub.authenticator_class = "dummy"
# while using dummy auth, make the *public* (proxy) interface private
c.JupyterHub.ip = "127.0.0.1"
# we need the hub to listen on all ips when it is in a container
c.JupyterHub.hub_ip = "0.0.0.0"
# may need to set hub_connect_ip to be connectable to containers
# default hostname behavior usually works, though
# c.JupyterHub.hub_connect_ip
# pick a default image to use when none is specified
c.DockerSpawner.image = "jupyter/base-notebook"
# delete containers when they stop
c.DockerSpawner.remove = True