1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-21 18:06:36 +02:00
dockerfiles/jupyter
2022-02-08 18:12:15 +08:00
..
docker-compose.yml update jupyter 2022-02-08 18:12:15 +08:00
nginx.conf update jupyter 2020-09-09 15:01:34 +08:00
README.md update jupyter 2022-02-08 18:12:15 +08:00

jupyter

Minimal Jupyter Notebook Stack

docker-compose.yml

how to select an image

version: "3.8"
services:
  notebook:
    image: jupyter/minimal-notebook
    ports:
      - "8888:8888"
    volumes:
      - ./data:/home/jovyan
    restart: unless-stopped

up and running

$ cd ~/fig/jupyter/
$ mkdir -p data/.jupyter
$ chown -R 1000:100 data
$ docker-compose up -d
$ curl http://127.0.0.1:8888

reset password

$ docker-compose exec notebook bash
>>> jupyter notebook password
Enter password: ******
Verify password: ******
[NotebookPasswordApp] Wrote hashed password to /home/jovyan/.jupyter/jupyter_notebook_config.json
$ docker-compose restart

without password

File: ./data/.jupyter/jupyter_notebook_config.json

{
  "NotebookApp": {
    "token": "",
    "password": "",
    "disable_check_xsrf": true
  }
}

kill idle kernels (1 week ago)

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