Jupyter Sandbox Setup Guide - ajgillis04/GillisDockerDepot GitHub Wiki
A locked-down Jupyter server where OpenWebUI Setup Guide (WSL2 Docker) runs Python written by the local model, for maths, data work and charts. Because the model writes this code, and web pages it reads could try to steer what it writes, the sandbox is isolated as tightly as possible.
compose/server2/jupyter-sandbox.yaml:
services:
jupyter-sandbox:
container_name: jupyter-sandbox.${HOST_NAME}
image: quay.io/jupyter/scipy-notebook@sha256:<digest> # pinned by digest
command: ["start-notebook.py", "--IdentityProvider.token=${JUPYTER_SANDBOX_TOKEN}",
"--ServerApp.allow_origin=*", "--ServerApp.disable_check_xsrf=True"]
environment:
TZ: ${TZ}
networks:
- llm_sandbox
restart: always
mem_limit: 4g
cpus: 4
pids_limit: 512
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
networks:
llm_sandbox:
internal: true # no internet, no LAN-
llm_sandboxis an internal network: no internet and no LAN. Open WebUI is the only other member, so it's the only thing that can reach the sandbox. - No host folders mounted, so code can't touch your files. Anything it writes disappears when the container restarts.
- Not root, no Linux capabilities,
no-new-privileges. - Limits on memory, CPU and processes, so a runaway loop can't take the machine down.
- No published ports.
- Add
llm_sandboxto Open WebUI's networks. -
Admin Panel → Settings → Code Execution: engine Jupyter, URL
http://jupyter-sandbox:8888, auth Token, the token from.env. - Turn on code execution and/or the code interpreter for the models that should use it.
- The
scipy-notebookimage already has numpy, pandas, matplotlib and scipy. Without internet,pip installwon't work, which is intentional. - Pinning by digest means updates are deliberate; Watchtower is off for it.