Skip to content

Jupyterhub doesn't support docker-stacks/base-notebook with RESTARTABLE #542

@akhmerov

Description

@akhmerov

Bug description

Jupyter docker-stacks support a RESTARTABLE=yes flag, which allows the user to restart their server if they want to adjust its config without losing the container. To the best of my understanding, the hub doesn't support this behavior.

How to reproduce

Confirming the expected behavior

docker run -it --rm \
        -p 8888:8888 \
        -e RESTARTABLE=yes \
        quay.io/jupyter/base-notebook

visit localhost:8888/lab, open terminal, type jupyter server stop 8888, observe a restart ✨

Hub failing

Create jupyterhub_config.py with

from dockerspawner import DockerSpawner

c = get_config()

# Use DockerSpawner
c.JupyterHub.spawner_class = DockerSpawner
c.JupyterHub.authenticator_class = 'firstuseauthenticator.FirstUseAuthenticator'

# Minimal DockerSpawner config for local use
c.DockerSpawner.image = 'quay.io/jupyter/base-notebook:latest'
c.DockerSpawner.remove = True  # Remove containers when stopped

c.DockerSpawner.use_internal_ip = False
c.JupyterHub.hub_ip = "0.0.0.0"
c.JupyterHub.hub_connect_ip = '172.17.0.1'

# Set environment variable RESTARTABLE=yes in spawned containers
c.DockerSpawner.environment = {"RESTARTABLE": "yes"}

and pixi.toml (or other env)

[workspace]
channels = ["https://prefix.dev/conda-forge"]
name = "jupyterhub_restartable"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
jupyterhub = ">=5.3.0,<6"
dockerspawner = ">=14.0.0,<15"

[pypi-dependencies]
jupyterhub-firstuseauthenticator = ">=1.1.1, <2"

Execute sudo /home/<USERNAME>/.pixi/bin/pixi run jupyterhub -f jupyterhub_config.py

Navigate to localhost:8000 and log in. Stop jupyter server like before and observe the hub killing the container.

Your personal set up

  • OS: Ubuntu 25.04
  • Version(s): latest (see toml above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions