A lightweight JupyterHub running on localhost via Docker, based on the official JupyterHub stack. This setup enables quick local deployment for testing and development.
JH-Lite is ideal for:
- Testing research workflows before production deployment
- Customizing notebook environments and extensions
- Preparing for institutional JupyterHub deployment
- Providing a quick entry point for new collaborators
jh-lite/
├── jupyterhub-system-data/ # JupyterHub system files (database, cookies)
├── ssl/ # SSL certificates for HTTPS
├── create-admin.py # Admin user creation script
├── docker-compose.yml # Docker service configuration
├── Dockerfile # Container definition
├── generate-certificates.sh # SSL certificate generator (Linux/Mac)
├── generate-certificates.ps1 # SSL certificate generator (Windows)
├── jupyterhub_config.py # JupyterHub configuration
├── README.md # This documentation
└── LICENSE # Project license
- Clone the repository
- Generate SSL certificates:
- Linux/Mac:
sh generate-certificates.sh - Windows:
PowerShell -ExecutionPolicy Bypass -File .\generate-certificates.ps1
- Linux/Mac:
- Run
docker-compose up -d --build - Create admin:
docker exec -it jupyterhub python /srv/jupyterhub/create-admin.py admin yourpassword - Access: https://localhost:8443 (secure HTTPS connection)
- Docker and Docker Compose installed
- Windows, macOS, or Linux operating system
- Port 8000 (for HTTP) or 8443 (for HTTPS) available
- Internet access to pull Docker images
From the root of the jh-lite project:
# Make sure the system data directory exists
mkdir -p jupyterhub-system-data
# Start JupyterHub
docker-compose up -d --buildFor Windows PowerShell users:
# Create directory if it doesn't exist
New-Item -Path "jupyterhub-system-data" -ItemType Directory -Force
# Start the service
docker compose up -d --buildThe service will be accessible at: http://localhost:8000 (or https://localhost:8443 if HTTPS is enabled)
Create an admin user for initial login:
# Create admin user
docker exec -it jupyterhub python /srv/jupyterhub/create-admin.py admin yourpasswordReplace yourpassword with a secure password of your choice.
Once you've created the admin user, you can:
- Log in at
http://localhost:8000(orhttps://localhost:8443) with your admin credentials - Use the admin interface at
/hub/adminto manage users - Users can self-register at
/hub/signup
JupyterHub warns about running over unsecured HTTP. To enable HTTPS:
-
Generate self-signed certificates:
# For Linux or Mac sh generate-certificates.sh # For Windows PowerShell PowerShell -ExecutionPolicy Bypass -File .\generate-certificates.ps1
Note for Windows: You'll need to install OpenSSL first from https://slproweb.com/products/Win32OpenSSL.html
-
Update docker-compose.yml (already configured in this repository):
- Ensure SSL certificate volume mounts are uncommented
- Ensure SSL environment variables are uncommented
- Ensure port 8443 is used instead of 8000
-
Restart JupyterHub:
docker-compose down docker-compose up -d
-
Access via HTTPS:
https://localhost:8443Note: Self-signed certificates will trigger browser warnings. For production, use certificates from a trusted Certificate Authority.
JH-Lite uses different storage locations for different types of data:
-
System Data (
jupyterhub-system-data/):- Local directory containing JupyterHub database and cookie secrets
- Used by the JupyterHub service for authentication and state management
- Do not use this for your own data files
-
Docker Volume (
jupyterhub-data):- Docker-managed persistent volume
- Used internally by JupyterHub
-
User Notebooks and Files:
- Each user gets their own workspace inside their notebook container
- To share datasets with notebooks, create a dedicated
datasetsdirectory and mount it - You can add dataset mounts by editing
docker-compose.ymlandjupyterhub_config.py
To stop the service:
docker-compose downTo remove all data including volumes (warning: this deletes all persistent data):
docker-compose down -vView logs:
docker-compose logs -fIf you're having authentication problems:
- Make sure you've created an admin user with the create-admin.py script
- Verify the user is authorized in the admin panel
- Check logs for any authentication errors:
docker-compose logs | grep auth
If containers aren't starting properly:
- Check for port conflicts:
docker-compose ps
- Verify Docker socket access:
docker info
- Try rebuilding the container:
docker-compose down docker-compose up -d --build
Modify the following files to customize your deployment:
jupyterhub_config.py- Configure authentication, spawner options, and security settingsDockerfile- Add custom packages or system dependenciesdocker-compose.yml- Change ports, volumes, and environment variables
To make datasets available to notebooks:
-
Create a datasets directory:
mkdir -p datasets # Add your data files here -
Edit
docker-compose.ymlto add the volume:services: hub: volumes: # ... existing volumes - ./datasets:/srv/jupyterhub/datasets
-
Edit
jupyterhub_config.pyto mount datasets in user containers:# In customize_volumes function: spawner.volumes['/srv/jupyterhub/datasets'] = {'bind': '/home/jovyan/datasets', 'mode': 'ro'}
For more extensive configuration options, see the JupyterHub documentation.