docker/jupyter/README.md

68 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2022-10-01 17:30:14 -07:00
# Jupyter Docker Image
This directory contains build files for a complete jupyter environment. It is based off the following repositories:
- https://github.com/jupyter/docker-stacks
- https://github.com/rgriffogoes/scraper-notebook
- https://github.com/sharpTrick/sage-notebook
2023-03-05 10:14:13 -08:00
The images these files produce contain everything you could possibly want in a jupyter notebook. Additional packages can be installed in notebooks with `%%bash` magic.
2022-10-01 17:30:14 -07:00
## Building the Image
To build this image, run `build/build.fish.` Edit the script to customize the image.
## Image contents
- jupyter + all dependencies
- Python + many packages
- Octave
- R
- Julia
## TODO
- Fix sage
- Haskell ([source](https://github.com/IHaskell/ihaskell-notebook))
- Maxima Kernel
2022-10-01 20:39:47 -07:00
## Configuration
Change the permissions on the configuration volume (see `docker-compose.yml`) if you get errors.
You may want to add the following lines to `jupyter_notebook_config.py`:
2022-10-09 21:02:49 -07:00
```python
2022-10-01 20:39:47 -07:00
c.ServerApp.local_hostnames = ["localhost", "0.0.0.0"]
c.ServerApp.token = "a_long_random_string"
2022-10-09 21:02:49 -07:00
c.TagRemovePreprocessor.enabled = True
c.TagRemovePreprocessor.remove_cell_tags = ("hide_cell",)
c.TagRemovePreprocessor.remove_all_outputs_tags = ("hide_output",)
c.TagRemovePreprocessor.remove_input_tags = ("hide_input",)
2022-10-01 20:39:47 -07:00
```
The first sets `0.0.0.0` to the allowed local hostname list. This prevents a possible "connection reset" when connecting to the docker container. Opens jupyter up to the outside internet, but you should have your inbound ports firewalled off anyway.
The second line sets a persistent token. If this config value is unset, jupyter will generate a new one on each run, making it hard to make a one-click bookmark.
### As a Server
2022-10-01 17:30:14 -07:00
Add the following lines and remove ``c.ServerApp.token``. This allows remote access and enables password authentication. **Warning:** be careful. Anyone with access to this server has a shell in your system.
2022-10-01 17:30:14 -07:00
```python
c.NotebookApp.allow_remote_access = True
c.NotebookApp.allow_origin = "*"
c.ServerApp.ip = "*"
c.ServerApp.password = u"pwd_str"
c.ServerApp.open_browser = False
```
Passwords can be generated with
```python
from jupyter_server.auth import passwd
passwd()
```