Skip to content

Commit e4abebe

Browse files
authored
MAINT: harden jupyter docker (#1584)
1 parent b9f4e47 commit e4abebe

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

doc/getting_started/install_docker.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,22 @@ docker-compose logs -f
5959

6060
### 4. Access JupyterLab
6161

62-
Once the container is running, open your browser and navigate to:
62+
Once the container is running, retrieve the access URL (including the authentication token) from the logs:
6363

64+
```bash
65+
docker-compose logs pyrit-jupyter
6466
```
65-
http://localhost:8888
67+
68+
Look for a line like:
69+
70+
```
71+
http://127.0.0.1:8888/lab?token=<your-token>
6672
```
6773

68-
By default, JupyterLab runs without authentication for ease of use.
74+
Open that full URL in your browser. The token is required for access.
6975

70-
```{warning}
71-
The default configuration has no password. For production use, consider adding authentication.
76+
```{note}
77+
JupyterLab is bound to `localhost` only and requires token authentication. Your API credentials are mounted into the container, so these protections prevent unauthorized access from other machines on your network.
7278
```
7379

7480
## Using PyRIT in JupyterLab

docker/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
image: pyrit:latest
1616
container_name: pyrit-jupyter
1717
ports:
18-
- "8888:8888"
18+
- "127.0.0.1:8888:8888"
1919
volumes:
2020
- notebooks:/app/notebooks
2121
- data:/app/data
@@ -26,7 +26,7 @@ services:
2626
- PYRIT_MODE=jupyter
2727
restart: unless-stopped
2828
healthcheck:
29-
test: ["CMD-SHELL", "curl -sf http://localhost:8888 || exit 1"]
29+
test: ["CMD-SHELL", "curl -sf http://localhost:8888/api/status || exit 1"]
3030
interval: 30s
3131
timeout: 10s
3232
retries: 3

docker/start.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ python -c "import pyrit; print(f'Running PyRIT version: {pyrit.__version__}')"
4141
if [ "$PYRIT_MODE" = "jupyter" ]; then
4242
echo "Starting JupyterLab on port 8888..."
4343
echo "Note: Notebooks are from the local source at build time"
44-
exec jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.password='' --notebook-dir=/app/notebooks
44+
echo "JupyterLab will generate an access token. Check the logs for the URL with token."
45+
exec jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root --notebook-dir=/app/notebooks
4546
elif [ "$PYRIT_MODE" = "gui" ]; then
4647
echo "Starting PyRIT GUI on port 8000..."
4748
exec python -m uvicorn pyrit.backend.main:app --host 0.0.0.0 --port 8000

0 commit comments

Comments
 (0)