diff --git a/jupyter/README.md b/jupyter/README.md index cd548b4..e7f3256 100644 --- a/jupyter/README.md +++ b/jupyter/README.md @@ -8,14 +8,15 @@ Minimal Jupyter Notebook Stack [how to select an image](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html) ```yaml -notebook: - image: jupyter/scipy-notebook - hostname: jupyter-notebook - ports: - - "8888:8888" - volumes: - - ./data:/home/jovyan - restart: unless-stopped +version: "3.8" +services: + notebook: + image: jupyter/minimal-notebook + ports: + - "8888:8888" + volumes: + - ./data:/home/jovyan + restart: unless-stopped ``` ## up and running @@ -47,11 +48,20 @@ File: ./data/.jupyter/jupyter_notebook_config.json { "NotebookApp": { "token": "", - "password": "" + "password": "", + "disable_check_xsrf": true } } ``` +## kill idle kernels (1 week ago) + +```bash +curl -s "http://127.0.0.1:8888/api/kernels" | + jq -r '.[]|select(now - (.last_activity|sub("\\..*Z";"Z")|fromdateiso8601) > 3600*24*7 and .connections==0).id' | + while read kid; do curl -s -w '\n' -X DELETE "http://127.0.0.1:8888/api/kernels/$kid"; done +``` + ## nginx config - diff --git a/jupyter/docker-compose.yml b/jupyter/docker-compose.yml index 4885075..b54ecca 100644 --- a/jupyter/docker-compose.yml +++ b/jupyter/docker-compose.yml @@ -1,8 +1,9 @@ -notebook: - image: jupyter/scipy-notebook - hostname: jupyter-notebook - ports: - - "8888:8888" - volumes: - - ./data:/home/jovyan - restart: unless-stopped +version: "3.8" +services: + notebook: + image: jupyter/minimal-notebook + ports: + - "8888:8888" + volumes: + - ./data:/home/jovyan + restart: unless-stopped