1
1
I am trying to set up jupyterlab on docker.
I am basing my solution on https://opendreamkit.org/2018/10/17/jupyterhub-docker/ with main exception being authorization with local linux user accounts.
After logging in I get following error:
jupyterhub_hub | [I 2019-03-10 18:59:01.297 JupyterHub dockerspawner:706] Found existing container jupyter-jlyskawa (id: 3a5c54c)
jupyterhub_hub | [I 2019-03-10 18:59:01.297 JupyterHub dockerspawner:721] Starting container jupyter-jlyskawa (id: 3a5c54c)
jupyterhub_hub | [E 2019-03-10 18:59:01.323 JupyterHub user:477] Unhandled error starting jlyskawa's server: The 'ip' trait of a Server instance must be a unicode string, but a value of None <class 'NoneType'> was specified.
jupyterhub_hub | [E 2019-03-10 18:59:01.349 JupyterHub web:1670] Uncaught exception GET /hub/user/jlyskawa/ (::ffff:172.19.0.1)
jupyterhub_hub | HTTPServerRequest(protocol='http', host='172.19.0.4:8000', method='GET', uri='/hub/user/jlyskawa/', version='HTTP/1.1', remote_ip='::ffff:172.19.0.1')
jupyterhub_hub | Traceback (most recent call last):
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
jupyterhub_hub | result = yield result
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 1052, in get
jupyterhub_hub | await self.spawn_single_user(user)
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 705, in spawn_single_user
jupyterhub_hub | timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 626, in finish_user_spawn
jupyterhub_hub | await spawn_future
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 489, in spawn
jupyterhub_hub | raise e
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 420, in spawn
jupyterhub_hub | server.ip = urlinfo.hostname
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py", line 585, in __set__
jupyterhub_hub | self.set(obj, value)
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py", line 559, in set
jupyterhub_hub | new_value = self._validate(obj, value)
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py", line 591, in _validate
jupyterhub_hub | value = self.validate(obj, value)
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py", line 2054, in validate
jupyterhub_hub | self.error(obj, value)
jupyterhub_hub | File "/opt/conda/lib/python3.6/site-packages/traitlets/traitlets.py", line 625, in error
jupyterhub_hub | raise TraitError(e)
jupyterhub_hub | traitlets.traitlets.TraitError: The 'ip' trait of a Server instance must be a unicode string, but a value of None <class 'NoneType'> was specified.
Is there any way to fix it/go around it?
Additional information:
Directory structure:
docker
+-- .env
+-- docker_compose.yml
+-- jupyterhub/
| +-- Dockerfile
| +-- jupyter-config.py
+-- jupyterlab/
| +-- Dockerfile
+-- reverse-proxy/
+-- traefik.toml
.env:
COMPOSE_PROJECT_NAME=my_hub
docker-compose.yml:
version: '2'
services:
# Configuration for Hub+Proxy
jupyterhub:
build: jupyterhub
container_name: jupyterhub_hub
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
- /etc/shadow:/etc/shadow:ro
environment: # Env variables passed to the Hub process.
DOCKER_JUPYTER_IMAGE: jupyterlab_img
DOCKER_NETWORK_NAME: ${COMPOSE_PROJECT_NAME}_default
HUB_IP: jupyterhub_hub
labels: # Traefik configuration.
- "traefik.enable=true"
- "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
# Configuration for reverse proxy
reverse-proxy:
image: traefik
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./reverse-proxy/traefik.toml:/etc/traefik/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock
- /etc/certs:/etc/certs
# Configuration for the single-user servers
jupyterlab:
build: jupyterlab
container_name: jupyterlab_img
command: echo
environment:
JUPYTER_ENABLE_LAB: 'yes'
jupyterhub/Dockerfile:
FROM jupyterhub/jupyterhub:0.9.4
USER root
COPY jupyterhub_config.py .
RUN pip install \
dockerspawner==0.10.0
jupyterhub/jupyter-config.py:
import os
c.JupyterHub.admin_access = True
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
c.DockerSpawner.image = os.environ['DOCKER_JUPYTER_IMAGE']
c.DockerSpawner.network_name = os.environ['DOCKER_NETWORK_NAME']
c.DockerSpawner.debug = True
c.JupyterHub.hub_ip = os.environ['HUB_IP']
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
jupyterlab/Dockerfile:
FROM jupyter/datascience-notebook
RUN conda install --quiet --yes \
'r-base=3.4.1' \
'r-irkernel=0.8*'&& \
conda clean -tipsy
reverse-proxy/traefik.toml:
debug = true
logLevel = "DEBUG"
defaultEntryPoints = ["http"]
# Redirect HTTP -> HTTPS, install certificates
[entryPoints]
[entryPoints.http]
address = ":80"
# Activate docker API
[docker]
domain = "docker.local"
watch = true
# Activate Traefik dashboard
[api]
Unhandled error starting jlyskawa's server: The 'ip' trait of a Server instance must be a unicode string, but a value of None <class 'NoneType'> was specified.
tells you what is wrong ... – DavidPostill – 2019-03-10T19:28:00.213Possibly, but there is no idea ip of what it is, where to set it or what ip would docker container have – J. Łyskawa – 2019-03-10T19:45:13.617
Well you could try searching for the error message
– DavidPostill – 2019-03-10T19:48:33.060And you would find this open issue ... traitlets.traitlets.TraitError: The 'ip' trait of a Server instance must be a unicode string, but a value of None <class 'NoneType'> was specified · Issue #2213 · jupyterhub/jupyterhub
– DavidPostill – 2019-03-10T19:49:44.667@DavidPostill to be honest I had no idea that network name used in this tutorial was invalid, after changing to "bridge" I managed to move forward, however I got another errors. In a while I will add an answer or another question – J. Łyskawa – 2019-03-10T20:02:18.440