Hi, I have a problem, becouse I used this example config and it worked fine, but when I started to do something with volumes, I got error:
Unhandled error starting d746c770-7eee-40fa-b073-97fe3a578569’s server: The ‘ip’ trait of a Server instance must be a unicode string, but a value of None <class ‘NoneType’> was specified.
All I changed was jupyterhub_config.py - I added volumes and changed authenticator, but that’s all:
import os
c.JupyterHub.authenticator_class = "tmpauthenticator.TmpAuthenticator"
# launch with docker
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
# we need the hub to listen on all ips when it is in a container
c.JupyterHub.hub_ip = '0.0.0.0'
# the hostname/ip that should be used to connect to the hub
# this is usually the hub container's name
c.JupyterHub.hub_connect_ip = 'jupyterhub'
# pick a docker image. This should have the same version of jupyterhub
# in it as our Hub.
c.DockerSpawner.image = 'jupyter/scipy-notebook'
# tell the user containers to connect to our docker network
c.DockerSpawner.network_name = 'jupyterhub'
# delete containers when the stop
c.DockerSpawner.remove = True
c.DockerSpawner.volumes = {'/volumes/jupyterhub/{username}/': '/home/jovyan/work'}
def create_dir_hook(spawner):
""" Create directory """
username = spawner.user.name # get the username
volume_path = os.path.join('/volumes/jupyterhub', username)
if not os.path.exists(volume_path):
os.makedirs(volume_path, mode=0o755, exist_ok = True)
filepath = os.path.join(volume_path, 'file.txt')
with open(filepath, 'w') as fp:
pass
c.Spawner.pre_spawn_hook = create_dir_hook
I saw other topics with this error, but none with solution, so I would be very glad for one