You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users sometimes share interesting ways of using the Jupyter Docker Stacks. We encourage users to [contribute these recipes](../contributing/recipes.md) to the documentation in case they prove useful to other members of the community by submitting a pull request to `docs/using/recipes.md`. The sections below capture this knowledge.
3
+
Users sometimes share interesting ways of using the Jupyter Docker Stacks. We encourage users to
4
+
[contribute these recipes](../contributing/recipes.md) to the documentation in case they prove
5
+
useful to other members of the community by submitting a pull request to `docs/using/recipes.md`.
6
+
The sections below capture this knowledge.
7
+
8
+
## Using `sudo` within a container
9
+
10
+
Password authentication is disabled for the `NB_USER` (e.g., `jovyan`). This choice was made to
11
+
avoid distributing images with a weak default password that users ~might~ will forget to change
12
+
before running a container on a publicly accessible host.
13
+
14
+
You can grant the within-container `NB_USER` passwordless `sudo` access by adding
15
+
`-e GRANT_SUDO=yes` and `--user root` to your Docker command line or appropriate container
16
+
orchestrator config.
17
+
18
+
For example:
19
+
20
+
```
21
+
docker run -it -e GRANT_SUDO=yes --user root jupyter/minimal-notebook
22
+
```
23
+
24
+
**You should only enable `sudo` if you trust the user and/or if the container is running on an
25
+
isolated host.**
4
26
5
27
## Using `pip install` or `conda install` in a Child Docker image
Python 2.x was removed from all images on August 10th, 2017, starting in tag `cc9feab481f7`. You can add a Python 2.x environment by defining your own Dockerfile inheriting from one of the images like so:
74
+
Python 2.x was removed from all images on August 10th, 2017, starting in tag `cc9feab481f7`. You can
75
+
add a Python 2.x environment by defining your own Dockerfile inheriting from one of the images like
JupyterLab is preinstalled as a notebook extension starting in tag [c33a7dc0eece](https://github.com/jupyter/docker-stacks/wiki/Docker-build-history).
103
+
JupyterLab is preinstalled as a notebook extension starting in tag
Run jupyterlab using a command such as `docker run -it --rm -p 8888:8888 jupyter/datascience-notebook start.sh jupyter lab`
106
+
Run jupyterlab using a command such as
107
+
`docker run -it --rm -p 8888:8888 jupyter/datascience-notebook start.sh jupyter lab`
80
108
81
109
## Let's Encrypt a Notebook server
82
110
83
-
See the README for the simple automation here [https://github.com/jupyter/docker-stacks/tree/master/examples/make-deploy](https://github.com/jupyter/docker-stacks/tree/master/examples/make-deploy) which includes steps for requesting and renewing a Let's Encrypt certificate.
[RISE](https://github.com/damianavila/RISE) allows via extension to create live slideshows of your notebooks, with no conversion, adding javascript Reveal.js:
120
+
[RISE](https://github.com/damianavila/RISE) allows via extension to create live slideshows of your
121
+
notebooks, with no conversion, adding javascript Reveal.js:
90
122
91
123
```
92
124
# Add Live slideshows with RISE
93
125
RUN conda install -c damianavila82 rise
94
126
```
95
-
Credit: [Paolo D.](https://github.com/pdonorio) based on [docker-stacks/issues/43](https://github.com/jupyter/docker-stacks/issues/43)
127
+
128
+
Credit: [Paolo D.](https://github.com/pdonorio) based on
You need to install conda's gcc for Python xgboost to work properly. Otherwise, you'll get an exception about libgomp.so.1 missing GOMP_4.0.
133
+
You need to install conda's gcc for Python xgboost to work properly. Otherwise, you'll get an
134
+
exception about libgomp.so.1 missing GOMP_4.0.
100
135
101
136
```
102
137
%%bash
@@ -110,20 +145,31 @@ import xgboost
110
145
111
146
Sometimes it is useful to run the Jupyter instance behind a nginx proxy, for instance:
112
147
113
-
- you would prefer to access the notebook at a server URL with a path (`https://example.com/jupyter`) rather than a port (`https://example.com:8888`)
114
-
- you may have many different services in addition to Jupyter running on the same server, and want to nginx to help improve server performance in manage the connections
148
+
- you would prefer to access the notebook at a server URL with a path
149
+
(`https://example.com/jupyter`) rather than a port (`https://example.com:8888`)
150
+
- you may have many different services in addition to Jupyter running on the same server, and want
151
+
to nginx to help improve server performance in manage the connections
115
152
116
-
Here is a [quick example NGINX configuration](https://gist.github.com/cboettig/8643341bd3c93b62b5c2) to get started. You'll need a server, a `.crt` and `.key` file for your server, and `docker` & `docker-compose` installed. Then just download the files at that gist and run `docker-compose up -d` to test it out. Customize the `nginx.conf` file to set the desired paths and add other services.
153
+
Here is a [quick example NGINX configuration](https://gist.github.com/cboettig/8643341bd3c93b62b5c2)
154
+
to get started. You'll need a server, a `.crt` and `.key` file for your server, and `docker` &
155
+
`docker-compose` installed. Then just download the files at that gist and run `docker-compose up -d`
156
+
to test it out. Customize the `nginx.conf` file to set the desired paths and add other services.
117
157
118
158
## Host volume mounts and notebook errors
119
159
120
-
If you are mounting a host directory as `/home/jovyan/work` in your container and you receive permission errors or connection errors when you create a notebook, be sure that the `jovyan` user (UID=1000 by default) has read/write access to the directory on the host. Alternatively, specify the UID of the `jovyan` user on container startup using the `-e NB_UID` option described in the [Common Features, Docker Options section](../using/common.html#Docker-Options)
160
+
If you are mounting a host directory as `/home/jovyan/work` in your container and you receive
161
+
permission errors or connection errors when you create a notebook, be sure that the `jovyan` user
162
+
(UID=1000 by default) has read/write access to the directory on the host. Alternatively, specify the
163
+
UID of the `jovyan` user on container startup using the `-e NB_UID` option described in the
Most containers, including our Ubuntu base image, ship without manpages installed to save space. You can use the following dockerfile to inherit from one of our images to enable manpages:
171
+
Most containers, including our Ubuntu base image, ship without manpages installed to save space. You
172
+
can use the following dockerfile to inherit from one of our images to enable manpages:
Adding the documentation on top of an existing singleuser image wastes a lot of space and requires reinstalling every system package, which can take additional time and bandwidth; the `datascience-notebook` image has been shown to grow by almost 3GB when adding manapages in this way. Enabling manpages in the base Ubuntu layer prevents this container bloat:
197
+
Adding the documentation on top of an existing singleuser image wastes a lot of space and requires
198
+
reinstalling every system package, which can take additional time and bandwidth; the
199
+
`datascience-notebook` image has been shown to grow by almost 3GB when adding manapages in this way.
200
+
Enabling manpages in the base Ubuntu layer prevents this container bloat:
152
201
153
202
```Dockerfile
154
203
# Ubuntu 18.04 (bionic) from 2018-05-26
@@ -178,18 +227,24 @@ We also have contributed recipes for using JupyterHub.
178
227
179
228
### Use JupyterHub's dockerspawner
180
229
181
-
In most cases for use with DockerSpawner, given any image that already has a notebook stack set up, you would only need to add:
230
+
In most cases for use with DockerSpawner, given any image that already has a notebook stack set up,
231
+
you would only need to add:
182
232
183
-
1. install the jupyterhub-singleuser script (for the right Python)
233
+
1. install the jupyterhub-singleuser script (for the right Python)
184
234
2. change the command to launch the single-user server
185
235
186
-
Swapping out the `FROM` line in the `jupyterhub/singleuser` Dockerfile should be enough for most cases.
236
+
Swapping out the `FROM` line in the `jupyterhub/singleuser` Dockerfile should be enough for most
237
+
cases.
187
238
188
-
Credit: [Justin Tyberg](https://github.com/jtyberg), [quanghoc](https://github.com/quanghoc), and [Min RK](https://github.com/minrk) based on [docker-stacks/issues/124](https://github.com/jupyter/docker-stacks/issues/124) and [docker-stacks/pull/185](https://github.com/jupyter/docker-stacks/pull/185)
239
+
Credit: [Justin Tyberg](https://github.com/jtyberg), [quanghoc](https://github.com/quanghoc), and
240
+
[Min RK](https://github.com/minrk) based on
241
+
[docker-stacks/issues/124](https://github.com/jupyter/docker-stacks/issues/124) and
If you'd like to use packages from [spark-packages.org](https://spark-packages.org/), see [https://gist.github.com/parente/c95fdaba5a9a066efaab](https://gist.github.com/parente/c95fdaba5a9a066efaab) for an example of how to specify the package identifier in the environment before creating a SparkContext.
331
+
If you'd like to use packages from [spark-packages.org](https://spark-packages.org/), see
0 commit comments