Skip to content

Instantly share code, notes, and snippets.

@matthewwiese
Created August 4, 2023 15:51
Show Gist options
  • Save matthewwiese/fb48729c2fc7e8be5cc0b6cc24e6ebc8 to your computer and use it in GitHub Desktop.
Save matthewwiese/fb48729c2fc7e8be5cc0b6cc24e6ebc8 to your computer and use it in GitHub Desktop.
jupyterhub/dockerspawner #453 - Volume Root Permissions Repro
version: '3.9'
services:
jupyterhub:
container_name: jupyterhub
restart: unless-stopped
build:
context: .
dockerfile: JupyterHub.dockerfile
networks:
- hub_net
ports:
- 8000:8000
volumes:
- "./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py:ro"
- "/run/user/1000/docker.sock:/var/run/docker.sock" # Access rootless socket associated with user
networks:
hub_net:
name: hub_net
FROM jupyterhub/jupyterhub:4.0.1
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --no-cache-dir \
dockerspawner
CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]
from dockerspawner import DockerSpawner
c = get_config() # noqa
c.JupyterHub.spawner_class = DockerSpawner
c.DockerSpawner.image = "jupyter/base-notebook:lab-3.6.3"
c.Spawner.default_url = '/lab'
c.DockerSpawner.cmd = "start-singleuser.sh"
c.DockerSpawner.remove = True
c.DockerSpawner.debug = True
c.DockerSpawner.hub_connect_url = "http://jupyterhub:8000"
c.DockerSpawner.use_internal_ip = True
c.DockerSpawner.network_name = "hub_net"
c.JupyterHub.port = 8000
c.JupyterHub.ip = "jupyterhub"
c.JupyterHub.hub_ip = "jupyterhub"
c.JupyterHub.authenticator_class = "dummy"
notebook_dir = "/home/jovyan/work"
c.DockerSpawner.notebook_dir = notebook_dir
c.DockerSpawner.volumes = { "/tmp/{username}": notebook_dir }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment