1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-16 11:58:47 +00:00
dockerfiles/jupyter/README.md

68 lines
1.3 KiB
Markdown
Raw Normal View History

2016-05-27 05:24:39 +00:00
jupyter
=======
2016-05-27 06:34:08 +00:00
Minimal Jupyter Notebook Stack
## docker-compose.yml
2020-09-09 07:01:34 +00:00
[how to select an image](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html)
2016-05-27 06:34:08 +00:00
```yaml
2022-02-08 10:12:01 +00:00
version: "3.8"
services:
notebook:
image: jupyter/minimal-notebook
ports:
- "8888:8888"
volumes:
- ./data:/home/jovyan
restart: unless-stopped
2016-05-27 06:34:08 +00:00
```
## up and running
2020-04-22 10:17:32 +00:00
```bash
$ cd ~/fig/jupyter/
$ mkdir -p data/.jupyter
$ chown -R 1000:100 data
$ docker-compose up -d
$ curl http://127.0.0.1:8888
2016-05-27 06:34:08 +00:00
```
2020-04-22 10:17:32 +00:00
## reset password
```bash
$ 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
```json
{
"NotebookApp": {
"token": "",
2022-02-08 10:12:01 +00:00
"password": "",
"disable_check_xsrf": true
2020-04-22 10:17:32 +00:00
}
}
2016-05-27 06:34:08 +00:00
```
2020-04-22 10:17:32 +00:00
2022-02-08 10:12:01 +00:00
## 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
```
2020-04-22 10:17:32 +00:00
## nginx config
- <https://hands-on.cloud/how-to-setup-jupyter-behind-nginx-proxy/>