Skip to content

Instantly share code, notes, and snippets.

@zonca
Last active August 15, 2017 10:23
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Jupyterhub configuration for docker swarm
import os
# Point DockerSpawner to Swarm instead of the local DockerEngine
os.environ["DOCKER_HOST"] = ":4000"
# We use NGINX for SSL
c.JupyterHub.confirm_no_ssl = True
# The docker instances need access to the Hub, so the default loopback port doesn't work:
from IPython.utils.localinterfaces import public_ips
c.JupyterHub.hub_ip = public_ips()[0]
c.JupyterHub.spawner_class = 'dockerspawner.SystemUserSpawner'
# see https://hub.docker.com/r/zonca/jupyterhub-datascience-systemuser/builds/
c.DockerSpawner.container_image = 'zonca/jupyterhub-datascience-systemuser'
c.DockerSpawner.remove_containers = True
# The docker instances need access to the Hub, so the default loopback port
# doesn't work. We need to tell the hub to listen on 0.0.0.0 because it's in a
# container, and we'll expose the port properly when the container is run. Then,
# we explicitly tell the spawned containers to connect to the proper IP address.
c.JupyterHub.proxy_api_ip = '0.0.0.0'
c.DockerSpawner.container_ip = '0.0.0.0'
c.DockerSpawner.use_internal_ip = False
c.DockerSpawner.hub_ip_connect = c.JupyterHub.hub_ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment