Skip to content

Commit 68d640f

Browse files
authored
Merge pull request #1599 from mathbunnyru/asalikhov/more_cleanup_docs
More docs cleanup
2 parents 3b4be78 + 45177c5 commit 68d640f

File tree

9 files changed

+96
-121
lines changed

9 files changed

+96
-121
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Example: `jupyter/scipy-notebook`
1616

1717
**What complete docker command do you run to launch the container (omitting sensitive values)?**
1818

19-
Example: `docker run -it --rm -p 8888:8888 jupyter/all-spark-notebook:latest`
19+
Example: `docker run -it --rm -p 8888:8888 jupyter/all-spark-notebook`
2020

2121
**What steps do you take once the container is running to reproduce the issue?**
2222

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ push-all-multi: $(foreach I, $(MULTI_IMAGES), push-multi/$(I)) $(foreach I, $(AM
191191

192192

193193

194-
run/%: ## run a bash in interactive mode in a stack
194+
run-shell/%: ## run a bash in interactive mode in a stack
195195
docker run -it --rm $(OWNER)/$(notdir $@) $(SHELL)
196196

197-
run-sudo/%: ## run a bash in interactive mode as root in a stack
198-
docker run -it --rm -u root $(OWNER)/$(notdir $@) $(SHELL)
197+
run-sudo-shell/%: ## run a bash in interactive mode as root in a stack
198+
docker run -it --rm --user root $(OWNER)/$(notdir $@) $(SHELL)
199199

200200

201201

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
Jupyter Docker Stacks are a set of ready-to-run [Docker images](https://hub.docker.com/u/jupyter) containing Jupyter applications and interactive computing tools.
1010
You can use a stack image to do any of the following (and more):
1111

12+
- Start a personal Jupyter Server with JupyterLab frontend (default)
13+
- Run JupyterLab for a team using JupyterHub
1214
- Start a personal Jupyter Notebook server in a local Docker container
13-
- Run JupyterLab servers for a team using JupyterHub
1415
- Write your own project Dockerfile
1516

1617
## Quick Start
@@ -48,7 +49,7 @@ This command pulls the `jupyter/datascience-notebook` image tagged `b418b67c225b
4849
It then starts an _ephemeral_ container running a Jupyter Server and exposes the server on host port 10000.
4950

5051
```bash
51-
docker run --rm -p 10000:8888 -v "${PWD}":/home/jovyan/work jupyter/datascience-notebook:b418b67c225b
52+
docker run -it --rm -p 10000:8888 -v "${PWD}":/home/jovyan/work jupyter/datascience-notebook:b418b67c225b
5253
```
5354

5455
The use of the `-v` flag in the command mounts the current working directory on the host (`{PWD}` in the example command) as `/home/jovyan/work` in the container.
@@ -58,6 +59,7 @@ Visiting `http://<hostname>:10000/?token=<token>` in a browser loads JupyterLab.
5859

5960
Due to the usage of [the flag `--rm`](https://docs.docker.com/engine/reference/run/#clean-up---rm) Docker automatically cleans up the container and removes the file
6061
system when the container exits, but any changes made to the `~/work` directory and its files in the container will remain intact on the host.
62+
[The `-it` flag](https://docs.docker.com/engine/reference/commandline/run/#assign-name-and-allocate-pseudo-tty---name--it) allocates pseudo-TTY.
6163

6264
## Contributing
6365

@@ -86,8 +88,8 @@ We will happily grant additional permissions (e.g., ability to merge PRs) to any
8688

8789
Following [Jupyter Notebook notice](https://github.com/jupyter/notebook#notice), JupyterLab is now the default for all of the Jupyter Docker stack images.
8890
It is still possible to switch back to Jupyter Notebook (or to launch a different startup command).
89-
You can achieve this by passing the environment variable `DOCKER_STACKS_JUPYTER_CMD=notebook` (or any other valid `jupyter` command) at container startup,
90-
more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#docker-options).
91+
You can achieve this by passing the environment variable `DOCKER_STACKS_JUPYTER_CMD=notebook` (or any other valid `jupyter` subcommand) at container startup,
92+
more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#alternative-commands).
9193

9294
According to the Jupyter Notebook project status and its compatibility with JupyterLab,
9395
these Docker images may remove the classic Jupyter Notebook interface altogether in favor of another _classic-like_ UI built atop JupyterLab.

docs/using/common.md

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# Common Features
22

3-
By default, a container launched from any Jupyter Docker Stacks image runs a Jupyter Notebook server.
3+
By default, a container launched from any Jupyter Docker Stacks image runs a Jupyter Server with JupyterLab frontend.
44
The container does so by executing a `start-notebook.sh` script.
5-
This script configures the internal container environment and then runs `jupyter notebook`, passing any command line arguments received.
5+
This script configures the internal container environment and then runs `jupyter lab`, passing any command line arguments received.
66

77
This page describes the options supported by the startup script and how to bypass it to run alternative commands.
88

9-
## Notebook Options
9+
## Jupyter Server Options
1010

11-
You can pass [Jupyter command line options](https://jupyter-notebook.readthedocs.io/en/stable/config.html#options) to the `start-notebook.sh` script when launching the container.
12-
For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token, you can run the following:
11+
You can pass [Jupyter server options](https://jupyter-notebook.readthedocs.io/en/stable/public_server.html) to the `start-notebook.sh` script when launching the container.
1312

14-
```bash
15-
docker run -d -p 8888:8888 \
16-
jupyter/base-notebook start-notebook.sh \
17-
--NotebookApp.password='sha1:74ba40f8a388:c913541b7ee99d15d5ed31d4226bf7838f83a50e'
18-
```
13+
1. For example, to secure the Notebook server with a custom password hashed using `IPython.lib.passwd()` instead of the default token,
14+
you can run the following (this hash was generated for `my-password` password):
1915

20-
For example, to set the base URL of the notebook server, you can run the following:
16+
```bash
17+
docker run -it --rm -p 8888:8888 jupyter/base-notebook \
18+
start-notebook.sh --NotebookApp.password='sha1:7cca89c48283:e3c1f9fbc06d1d2aa59555dfd5beed925e30dd2c'
19+
```
2120

22-
```bash
23-
docker run -d -p 8888:8888 \
24-
jupyter/base-notebook start-notebook.sh \
25-
--NotebookApp.base_url=/some/path
26-
```
21+
2. To set the [base URL](https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#running-the-notebook-with-a-customized-url-prefix) of the notebook server, you can run the following:
22+
23+
```bash
24+
docker run -it --rm -p 8888:8888 jupyter/base-notebook \
25+
start-notebook.sh --NotebookApp.base_url=/customized/url/prefix/
26+
```
2727

2828
## Docker Options
2929

@@ -42,9 +42,13 @@ You do so by passing arguments to the `docker run` command.
4242
Example usage:
4343

4444
```bash
45-
docker run --rm -it -p 8888:8888 \
46-
-e NB_USER="my-username" -e CHOWN_HOME=yes \
47-
-w "/home/${NB_USER}" --user root jupyter/base-notebook:latest
45+
docker run -it --rm \
46+
-p 8888:8888 \
47+
--user root \
48+
-e NB_USER="my-username" \
49+
-e CHOWN_HOME=yes \
50+
-w "/home/${NB_USER}" \
51+
jupyter/base-notebook
4852
```
4953

5054
- `-e NB_UID=<numeric uid>` - Instructs the startup script to switch the numeric user ID of `${NB_USER}` to the given value.
@@ -104,7 +108,8 @@ You do so by passing arguments to the `docker run` command.
104108

105109
### Additional runtime configurations
106110

107-
- `-e GEN_CERT=yes` - Instructs the startup script to generate a self-signed SSL certificate and configure Jupyter Notebook to use it to accept encrypted HTTPS connections.
111+
- `-e GEN_CERT=yes` - Instructs the startup script to generate a self-signed SSL certificate.
112+
Configures Jupyter Server to use it to accept encrypted HTTPS connections.
108113
- `-e DOCKER_STACKS_JUPYTER_CMD=<jupyter command>` - Instructs the startup script to run `jupyter ${DOCKER_STACKS_JUPYTER_CMD}` instead of the default `jupyter lab` command.
109114
See [Switching back to the classic notebook or using a different startup command][switch_back] for available options.
110115
This setting is helpful in container orchestration environments where setting environment variables is more straightforward than changing command line parameters.
@@ -115,29 +120,31 @@ You do so by passing arguments to the `docker run` command.
115120
**You must grant the within-container notebook user or group (`NB_UID` or `NB_GID`) write access to the host directory (e.g., `sudo chown 1000 /some/host/folder/for/work`).**
116121
- `-e JUPYTER_ENV_VARS_TO_UNSET=ADMIN_SECRET_1,ADMIN_SECRET_2` - Unsets specified environment variables in the default startup script.
117122
The variables are unset after the hooks have been executed but before the command provided to the startup script runs.
118-
- `-e NOTEBOOK_ARGS="--log-level='DEBUG' --dev-mode"` - Adds custom options to launch `jupyter lab` or `jupyter notebook`. This way, the user could use any option supported by `jupyter`.
123+
- `-e NOTEBOOK_ARGS="--log-level='DEBUG' --dev-mode"` - Adds custom options to add to `jupyter` commands.
124+
This way, the user could use any option supported by `jupyter` subcommand.
119125

120126
## Startup Hooks
121127

122128
You can further customize the container environment by adding shell scripts (`*.sh`) to be sourced
123129
or executables (`chmod +x`) to be run to the paths below:
124130

125-
- `/usr/local/bin/start-notebook.d/` - handled before any of the standard options noted above
126-
are applied
127-
- `/usr/local/bin/before-notebook.d/` - handled after all of the standard options noted above are applied and ran right before the notebook server launches
131+
- `/usr/local/bin/start-notebook.d/` - handled **before** any of the standard options noted above are applied
132+
- `/usr/local/bin/before-notebook.d/` - handled **after** all of the standard options noted above are applied
133+
and ran right before the notebook server launches
128134

129135
See the `run-hooks` function in the [`jupyter/base-notebook start.sh`](https://github.com/jupyter/docker-stacks/blob/master/base-notebook/start.sh)
130136
script for execution details.
131137

132138
## SSL Certificates
133139

134-
You may mount an SSL key and certificate file into a container and configure the Jupyter Notebook to use them to accept HTTPS connections.
140+
You may mount an SSL key and certificate file into a container and configure the Jupyter Server to use them to accept HTTPS connections.
135141
For example, to mount a host folder containing a `notebook.key` and `notebook.crt` and use them, you might run the following:
136142

137143
```bash
138-
docker run -d -p 8888:8888 \
144+
docker run -it --rm -p 8888:8888 \
139145
-v /some/host/folder:/etc/ssl/notebook \
140-
jupyter/base-notebook start-notebook.sh \
146+
jupyter/base-notebook \
147+
start-notebook.sh \
141148
--NotebookApp.keyfile=/etc/ssl/notebook/notebook.key \
142149
--NotebookApp.certfile=/etc/ssl/notebook/notebook.crt
143150
```
@@ -146,9 +153,10 @@ Alternatively, you may mount a single PEM file containing both the key and certi
146153
For example:
147154

148155
```bash
149-
docker run -d -p 8888:8888 \
156+
docker run -it --rm -p 8888:8888 \
150157
-v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \
151-
jupyter/base-notebook start-notebook.sh \
158+
jupyter/base-notebook \
159+
start-notebook.sh \
152160
--NotebookApp.certfile=/etc/ssl/notebook.pem
153161
```
154162

@@ -188,13 +196,15 @@ Example:
188196

189197
```bash
190198
# Run Jupyter Notebook on Jupyter Server
191-
docker run -it --rm -p 8888:8888 \
199+
docker run -it --rm \
200+
-p 8888:8888 \
192201
-e DOCKER_STACKS_JUPYTER_CMD=notebook \
193202
jupyter/base-notebook
194203
# Executing the command: jupyter notebook ...
195204

196205
# Run Jupyter Notebook classic
197-
docker run -it --rm -p 8888:8888 \
206+
docker run -it --rm \
207+
-p 8888:8888 \
198208
-e DOCKER_STACKS_JUPYTER_CMD=nbclassic \
199209
jupyter/base-notebook
200210
# Executing the command: jupyter nbclassic ...
@@ -210,12 +220,6 @@ For example, to run the text-based `ipython` console in a container, do the foll
210220
docker run -it --rm jupyter/base-notebook start.sh ipython
211221
```
212222

213-
Or, to run Jupyter Notebook classic instead of JupyterLab, run the following:
214-
215-
```bash
216-
docker run -it --rm -p 8888:8888 jupyter/base-notebook start.sh jupyter notebook
217-
```
218-
219223
This script is handy when you derive a new Dockerfile from this image and install additional Jupyter applications with subcommands like `jupyter console`, `jupyter kernelgateway`, etc.
220224

221225
### Others
@@ -230,7 +234,7 @@ The `/opt/conda/bin` directory is part of the default `jovyan` user's `${PATH}`.
230234
That directory is also searched for binaries when run using `sudo` (`sudo my_binary` will search for `my_binary` in `/opt/conda/bin/`
231235

232236
The `jovyan` user has full read/write access to the `/opt/conda` directory.
233-
You can use either `pip`, `conda` or `mamba` to install new packages without any additional permissions.
237+
You can use either `mamba`, `pip` or `conda` (`mamba` is recommended) to install new packages without any additional permissions.
234238

235239
```bash
236240
# install a package into the default (python 3.x) environment and cleanup after

docs/using/recipes.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ The sections below capture this knowledge.
99
Password authentication is disabled for the `NB_USER` (e.g., `jovyan`).
1010
We made this choice to avoid distributing images with a weak default password that users ~might~ will forget to change before running a container on a publicly accessible host.
1111

12-
You can grant the within-container `NB_USER` passwordless `sudo` access by adding `-e GRANT_SUDO=yes` and `--user root` to your Docker command line or appropriate container orchestrator config.
12+
You can grant the within-container `NB_USER` passwordless `sudo` access by adding `--user root` and `-e GRANT_SUDO=yes` to your Docker command line or appropriate container orchestrator config.
1313

1414
For example:
1515

1616
```bash
17-
docker run -it -e GRANT_SUDO=yes \
18-
--user root jupyter/minimal-notebook
17+
docker run -it --rm \
18+
--user root \
19+
-e GRANT_SUDO=yes \
20+
jupyter/minimal-notebook
1921
```
2022

2123
**You should only enable `sudo` if you trust the user and/or if the container is running on an isolated host.**
@@ -167,7 +169,8 @@ docker build -t jupyter/scipy-dasklabextension:latest .
167169
Once built, run using the command:
168170

169171
```bash
170-
docker run -it --rm -p 8888:8888 \
172+
docker run -it --rm \
173+
-p 8888:8888 \
171174
-p 8787:8787 jupyter/scipy-dasklabextension:latest
172175
```
173176

@@ -484,14 +487,16 @@ In this case, you should use the `start.sh` script to launch the server with no
484487
For JupyterLab:
485488

486489
```bash
487-
docker run jupyter/base-notebook:b418b67c225b \
490+
docker run -it --rm \
491+
jupyter/base-notebook:b418b67c225b \
488492
start.sh jupyter lab --LabApp.token=''
489493
```
490494

491495
For jupyter classic:
492496

493497
```bash
494-
docker run jupyter/base-notebook:b418b67c225b \
498+
docker run -it --rm \
499+
jupyter/base-notebook:b418b67c225b \
495500
start.sh jupyter notebook --NotebookApp.token=''
496501
```
497502

0 commit comments

Comments
 (0)