mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 18:44:06 +00:00
Fix more errors
This commit is contained in:
@@ -34,7 +34,7 @@ cookiecutter https://github.com/jupyter/cookiecutter-docker-stacks.git
|
|||||||
Enter a name for your new stack image. This will serve as both the git repository name and the part
|
Enter a name for your new stack image. This will serve as both the git repository name and the part
|
||||||
of the Docker image name after the slash.
|
of the Docker image name after the slash.
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
stack_name [my-jupyter-stack]:
|
stack_name [my-jupyter-stack]:
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -42,26 +42,26 @@ Enter the user or organization name under which this stack will reside on Docker
|
|||||||
must have access to manage this Docker Cloud org to push images here and set up automated
|
must have access to manage this Docker Cloud org to push images here and set up automated
|
||||||
builds.
|
builds.
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
stack_org [my-project]:
|
stack_org [my-project]:
|
||||||
```
|
```
|
||||||
|
|
||||||
Select an image from the jupyter/docker-stacks project that will serve as the base for your new
|
Select an image from the jupyter/docker-stacks project that will serve as the base for your new
|
||||||
image.
|
image.
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
stack_base_image [jupyter/base-notebook]:
|
stack_base_image [jupyter/base-notebook]:
|
||||||
```
|
```
|
||||||
|
|
||||||
Enter a longer description of the stack for your README.
|
Enter a longer description of the stack for your README.
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
stack_description [my-jupyter-stack is a community maintained Jupyter Docker Stack image]:
|
stack_description [my-jupyter-stack is a community maintained Jupyter Docker Stack image]:
|
||||||
```
|
```
|
||||||
|
|
||||||
Initialize your project as a Git repository and push it to GitHub.
|
Initialize your project as a Git repository and push it to GitHub.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
cd <stack_name you chose>
|
cd <stack_name you chose>
|
||||||
|
|
||||||
git init
|
git init
|
||||||
|
@@ -13,8 +13,8 @@ You can launch a local Docker container from the Jupyter Docker Stacks using the
|
|||||||
|
|
||||||
**Example 1** This command pulls the `jupyter/scipy-notebook` image tagged `2c80cf3537ca` from Docker Hub if it is not already present on the local host. It then starts a container running a Jupyter Notebook server and exposes the server on host port 8888. The server logs appear in the terminal and include a URL to the notebook server.
|
**Example 1** This command pulls the `jupyter/scipy-notebook` image tagged `2c80cf3537ca` from Docker Hub if it is not already present on the local host. It then starts a container running a Jupyter Notebook server and exposes the server on host port 8888. The server logs appear in the terminal and include a URL to the notebook server.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
docker run -p 8888:8888 jupyter/scipy-notebook:2c80cf3537ca
|
$ docker run -p 8888:8888 jupyter/scipy-notebook:2c80cf3537ca
|
||||||
|
|
||||||
Executing the command: jupyter notebook
|
Executing the command: jupyter notebook
|
||||||
[I 15:33:00.567 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
[I 15:33:00.567 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
||||||
@@ -35,27 +35,27 @@ Executing the command: jupyter notebook
|
|||||||
|
|
||||||
Pressing `Ctrl-C` shuts down the notebook server but leaves the container intact on disk for later restart or permanent deletion using commands like the following:
|
Pressing `Ctrl-C` shuts down the notebook server but leaves the container intact on disk for later restart or permanent deletion using commands like the following:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# list containers
|
# list containers
|
||||||
docker ps -a
|
$ docker ps -a
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
d67fe77f1a84 jupyter/base-notebook "tini -- start-noteb…" 44 seconds ago Exited (0) 39 seconds ago cocky_mirzakhani
|
d67fe77f1a84 jupyter/base-notebook "tini -- start-noteb…" 44 seconds ago Exited (0) 39 seconds ago cocky_mirzakhani
|
||||||
|
|
||||||
# start the stopped container
|
# start the stopped container
|
||||||
docker start -a d67fe77f1a84
|
$ docker start -a d67fe77f1a84
|
||||||
Executing the command: jupyter notebook
|
Executing the command: jupyter notebook
|
||||||
[W 16:45:02.020 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
|
[W 16:45:02.020 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
|
||||||
...
|
...
|
||||||
|
|
||||||
# remove the stopped container
|
# remove the stopped container
|
||||||
docker rm d67fe77f1a84
|
$ docker rm d67fe77f1a84
|
||||||
d67fe77f1a84
|
d67fe77f1a84
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example 2** This command pulls the `jupyter/r-notebook` image tagged `e5c5a7d3e52d` from Docker Hub if it is not already present on the local host. It then starts a container running a Jupyter Notebook server and exposes the server on host port 10000. The server logs appear in the terminal and include a URL to the notebook server, but with the internal container port (8888) instead of the the correct host port (10000).
|
**Example 2** This command pulls the `jupyter/r-notebook` image tagged `e5c5a7d3e52d` from Docker Hub if it is not already present on the local host. It then starts a container running a Jupyter Notebook server and exposes the server on host port 10000. The server logs appear in the terminal and include a URL to the notebook server, but with the internal container port (8888) instead of the the correct host port (10000).
|
||||||
|
|
||||||
```
|
```bash
|
||||||
docker run --rm -p 10000:8888 -v "$PWD":/home/jovyan/work jupyter/r-notebook:e5c5a7d3e52d
|
$ docker run --rm -p 10000:8888 -v "$PWD":/home/jovyan/work jupyter/r-notebook:e5c5a7d3e52d
|
||||||
|
|
||||||
Executing the command: jupyter notebook
|
Executing the command: jupyter notebook
|
||||||
[I 19:31:09.573 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
[I 19:31:09.573 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
||||||
@@ -78,19 +78,19 @@ Pressing `Ctrl-C` shuts down the notebook server and immediately destroys the Do
|
|||||||
|
|
||||||
**Example 3** This command pulls the `jupyter/all-spark-notebook` image currently tagged `latest` from Docker Hub if an image tagged `latest` is not already present on the local host. It then starts a container named `notebook` running a JupyterLab server and exposes the server on a randomly selected port.
|
**Example 3** This command pulls the `jupyter/all-spark-notebook` image currently tagged `latest` from Docker Hub if an image tagged `latest` is not already present on the local host. It then starts a container named `notebook` running a JupyterLab server and exposes the server on a randomly selected port.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
docker run -d -P --name notebook jupyter/all-spark-notebook
|
docker run -d -P --name notebook jupyter/all-spark-notebook
|
||||||
```
|
```
|
||||||
|
|
||||||
The assigned port and notebook server token are visible using other Docker commands.
|
The assigned port and notebook server token are visible using other Docker commands.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# get the random host port assigned to the container port 8888
|
# get the random host port assigned to the container port 8888
|
||||||
docker port notebook 8888
|
$ docker port notebook 8888
|
||||||
0.0.0.0:32769
|
0.0.0.0:32769
|
||||||
|
|
||||||
# get the notebook token from the logs
|
# get the notebook token from the logs
|
||||||
docker logs --tail 3 notebook
|
$ docker logs --tail 3 notebook
|
||||||
Copy/paste this URL into your browser when you connect for the first time,
|
Copy/paste this URL into your browser when you connect for the first time,
|
||||||
to login with a token:
|
to login with a token:
|
||||||
http://localhost:8888/?token=15914ca95f495075c0aa7d0e060f1a78b6d94f70ea373b00
|
http://localhost:8888/?token=15914ca95f495075c0aa7d0e060f1a78b6d94f70ea373b00
|
||||||
@@ -100,7 +100,7 @@ Together, the URL to visit on the host machine to access the server in this case
|
|||||||
|
|
||||||
The container runs in the background until stopped and/or removed by additional Docker commands.
|
The container runs in the background until stopped and/or removed by additional Docker commands.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# stop the container
|
# stop the container
|
||||||
docker stop notebook
|
docker stop notebook
|
||||||
notebook
|
notebook
|
||||||
|
@@ -10,7 +10,7 @@ Any OpenShift 3 environment. The templates were tested with OpenShift 3.7. It is
|
|||||||
|
|
||||||
Do be aware that the Jupyter Project docker-stacks images are very large. The OpenShift environment you are using must provide sufficient quota on the per user space for images and the file system for running containers. If the quota is too small, the pulling of the images to a node in the OpenShift cluster when deploying them, will fail due to lack of space. Even if the image is able to be run, if the quota is only just larger than the space required for the image, you will not be able to install many packages into the container before running out of space.
|
Do be aware that the Jupyter Project docker-stacks images are very large. The OpenShift environment you are using must provide sufficient quota on the per user space for images and the file system for running containers. If the quota is too small, the pulling of the images to a node in the OpenShift cluster when deploying them, will fail due to lack of space. Even if the image is able to be run, if the quota is only just larger than the space required for the image, you will not be able to install many packages into the container before running out of space.
|
||||||
|
|
||||||
OpenShift Online, the public hosted version of OpenShift from Red Hat has a quota of only 3GB for the image and container file system. As a result, only the ``minimal-notebook`` can be started and there is little space remaining to install additional packages. Although OpenShift Online is suitable for demonstrating these templates work, what you can do in that environment will be limited due to the size of the images.
|
OpenShift Online, the public hosted version of OpenShift from Red Hat has a quota of only 3GB for the image and container file system. As a result, only the `minimal-notebook` can be started and there is little space remaining to install additional packages. Although OpenShift Online is suitable for demonstrating these templates work, what you can do in that environment will be limited due to the size of the images.
|
||||||
|
|
||||||
If you want to experiment with using Jupyter Notebooks in an OpenShift environment, you should instead use [Minishift](https://www.openshift.org/minishift/). Minishift provides you the ability to run OpenShift in a virtual machine on your own local computer.
|
If you want to experiment with using Jupyter Notebooks in an OpenShift environment, you should instead use [Minishift](https://www.openshift.org/minishift/). Minishift provides you the ability to run OpenShift in a virtual machine on your own local computer.
|
||||||
|
|
||||||
@@ -23,13 +23,9 @@ To load the templates, login to OpenShift from the command line and run:
|
|||||||
oc create -f https://raw.githubusercontent.com/jupyter-on-openshift/docker-stacks/master/examples/openshift/templates.json
|
oc create -f https://raw.githubusercontent.com/jupyter-on-openshift/docker-stacks/master/examples/openshift/templates.json
|
||||||
```
|
```
|
||||||
|
|
||||||
This should create the following templates:
|
This should create the `jupyter-notebook` template
|
||||||
|
|
||||||
```
|
The template can be used from the command line using the `oc new-app` command, or from the OpenShift web console by selecting _Add to Project_. This `README` is only going to explain deploying from the command line.
|
||||||
jupyter-notebook
|
|
||||||
```
|
|
||||||
|
|
||||||
The template can be used from the command line using the ``oc new-app`` command, or from the OpenShift web console by selecting _Add to Project_. This ``README`` is only going to explain deploying from the command line.
|
|
||||||
|
|
||||||
Deploying a Notebook
|
Deploying a Notebook
|
||||||
--------------------
|
--------------------
|
||||||
@@ -42,7 +38,7 @@ oc new-app --template jupyter-notebook
|
|||||||
|
|
||||||
The output will be similar to:
|
The output will be similar to:
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
--> Deploying template "jupyter/jupyter-notebook" to project jupyter
|
--> Deploying template "jupyter/jupyter-notebook" to project jupyter
|
||||||
|
|
||||||
Jupyter Notebook
|
Jupyter Notebook
|
||||||
@@ -64,13 +60,13 @@ The output will be similar to:
|
|||||||
Run 'oc status' to view your app.
|
Run 'oc status' to view your app.
|
||||||
```
|
```
|
||||||
|
|
||||||
When no template parameters are provided, the name of the deployed notebook will be ``notebook``. The image used will be:
|
When no template parameters are provided, the name of the deployed notebook will be `notebook`. The image used will be:
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
jupyter/minimal-notebook:latest
|
jupyter/minimal-notebook:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
A password you can use when accessing the notebook will be auto generated and is displayed in the output from running ``oc new-app``.
|
A password you can use when accessing the notebook will be auto generated and is displayed in the output from running `oc new-app`.
|
||||||
|
|
||||||
To see the hostname for accessing the notebook run:
|
To see the hostname for accessing the notebook run:
|
||||||
|
|
||||||
@@ -80,14 +76,14 @@ oc get routes
|
|||||||
|
|
||||||
The output will be similar to:
|
The output will be similar to:
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
|
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
|
||||||
notebook notebook-jupyter.abcd.pro-us-east-1.openshiftapps.com notebook 8888-tcp edge/Redirect None
|
notebook notebook-jupyter.abcd.pro-us-east-1.openshiftapps.com notebook 8888-tcp edge/Redirect None
|
||||||
```
|
```
|
||||||
|
|
||||||
A secure route will be used to expose the notebook outside of the OpenShift cluster, so in this case the URL would be:
|
A secure route will be used to expose the notebook outside of the OpenShift cluster, so in this case the URL would be:
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
https://notebook-jupyter.abcd.pro-us-east-1.openshiftapps.com/
|
https://notebook-jupyter.abcd.pro-us-east-1.openshiftapps.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -96,7 +92,7 @@ When prompted, enter the password for the notebook.
|
|||||||
Passing Template Parameters
|
Passing Template Parameters
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
To override the name for the notebook, the image used, and the password, you can pass template parameters using the ``--param`` option.
|
To override the name for the notebook, the image used, and the password, you can pass template parameters using the `--param` option.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oc new-app --template jupyter-notebook \
|
oc new-app --template jupyter-notebook \
|
||||||
@@ -116,12 +112,12 @@ You can deploy any of the Jupyter Project docker-stacks images.
|
|||||||
* jupyter/pyspark-notebook
|
* jupyter/pyspark-notebook
|
||||||
* jupyter/all-spark-notebook
|
* jupyter/all-spark-notebook
|
||||||
|
|
||||||
If you don't care what version of the image is used, add the ``:latest`` tag at the end of the image name, otherwise use the hash corresponding to the image version you want to use.
|
If you don't care what version of the image is used, add the `:latest` tag at the end of the image name, otherwise use the hash corresponding to the image version you want to use.
|
||||||
|
|
||||||
Deleting the Notebook Instance
|
Deleting the Notebook Instance
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
To delete the notebook instance, run ``oc delete`` using a label selector for the application name.
|
To delete the notebook instance, run `oc delete` using a label selector for the application name.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oc delete all,configmap --selector app=mynotebook
|
oc delete all,configmap --selector app=mynotebook
|
||||||
@@ -130,7 +126,7 @@ oc delete all,configmap --selector app=mynotebook
|
|||||||
Enabling Jupyter Lab Interface
|
Enabling Jupyter Lab Interface
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
To enable the Jupyter Lab interface for a deployed notebook set the ``JUPYTER_ENABLE_LAB`` environment variable.
|
To enable the Jupyter Lab interface for a deployed notebook set the `JUPYTER_ENABLE_LAB` environment variable.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oc set env dc/mynotebook JUPYTER_ENABLE_LAB=true
|
oc set env dc/mynotebook JUPYTER_ENABLE_LAB=true
|
||||||
@@ -165,11 +161,11 @@ If you want to set any custom configuration for the notebook, you can edit the c
|
|||||||
oc edit configmap/mynotebook-cfg
|
oc edit configmap/mynotebook-cfg
|
||||||
```
|
```
|
||||||
|
|
||||||
The ``data`` field of the config map contains Python code used as the ``jupyter_notebook_config.py`` file.
|
The `data` field of the config map contains Python code used as the `jupyter_notebook_config.py` file.
|
||||||
|
|
||||||
If you are using a persistent volume, you can also create a configuration file at:
|
If you are using a persistent volume, you can also create a configuration file at:
|
||||||
|
|
||||||
```
|
```lang-none
|
||||||
/home/jovyan/.jupyter/jupyter_notebook_config.py
|
/home/jovyan/.jupyter/jupyter_notebook_config.py
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -177,7 +173,7 @@ This will be merged at the end of the configuration from the config map.
|
|||||||
|
|
||||||
Because the configuration is Python code, ensure any indenting is correct. Any errors in the configuration file will cause the notebook to fail when starting.
|
Because the configuration is Python code, ensure any indenting is correct. Any errors in the configuration file will cause the notebook to fail when starting.
|
||||||
|
|
||||||
If the error is in the config map, edit it again to fix it and trigged a new deployment if necessary by running:
|
If the error is in the config map, edit it again to fix it and trigger a new deployment if necessary by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oc rollout latest dc/mynotebook
|
oc rollout latest dc/mynotebook
|
||||||
@@ -216,15 +212,7 @@ oc set env dc/mynotebook JUPYTER_NOTEBOOK_PASSWORD=mypassword
|
|||||||
|
|
||||||
This will trigger a new deployment so ensure you have downloaded any work if not using a persistent volume.
|
This will trigger a new deployment so ensure you have downloaded any work if not using a persistent volume.
|
||||||
|
|
||||||
If using a persistent volume, you could instead setup a password in the file:
|
If using a persistent volume, you could instead setup a password in the file `/home/jovyan/.jupyter/jupyter_notebook_config.py` as per guidelines in <https://jupyter-notebook.readthedocs.io/en/stable/public_server.html>.
|
||||||
|
|
||||||
```
|
|
||||||
/home/jovyan/.jupyter/jupyter_notebook_config.py
|
|
||||||
```
|
|
||||||
|
|
||||||
as per guidelines in:
|
|
||||||
|
|
||||||
* <https://jupyter-notebook.readthedocs.io/en/stable/public_server.html>
|
|
||||||
|
|
||||||
Deploying from a Custom Image
|
Deploying from a Custom Image
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
@@ -3,7 +3,7 @@ Custom Jupyter Notebook images
|
|||||||
|
|
||||||
This example provides scripts for building custom Jupyter Notebook images containing notebooks, data files, and with Python packages required by the notebooks already installed. The scripts provided work with the Source-to-Image tool and you can create the images from the command line on your own computer. Templates are also provided to enable running builds in OpenShift, as well as deploying the resulting image to OpenShift to make it available.
|
This example provides scripts for building custom Jupyter Notebook images containing notebooks, data files, and with Python packages required by the notebooks already installed. The scripts provided work with the Source-to-Image tool and you can create the images from the command line on your own computer. Templates are also provided to enable running builds in OpenShift, as well as deploying the resulting image to OpenShift to make it available.
|
||||||
|
|
||||||
The build scripts, when used with the Source-to-Image tool, provide similar capabilities to ``repo2docker``. When builds are run under OpenShift with the supplied templates, it provides similar capabilities to ``mybinder.org``, but where notebook instances are deployed in your existing OpenShift project and JupyterHub is not required.
|
The build scripts, when used with the Source-to-Image tool, provide similar capabilities to `repo2docker`. When builds are run under OpenShift with the supplied templates, it provides similar capabilities to `mybinder.org`, but where notebook instances are deployed in your existing OpenShift project and JupyterHub is not required.
|
||||||
|
|
||||||
For separate examples of using JupyterHub with OpenShift, see the project:
|
For separate examples of using JupyterHub with OpenShift, see the project:
|
||||||
|
|
||||||
@@ -34,18 +34,19 @@ s2i build \
|
|||||||
notebook-examples
|
notebook-examples
|
||||||
```
|
```
|
||||||
|
|
||||||
This example command will pull down the Git repository ``https://github.com/jupyter/notebook`` and build the image ``notebook-examples`` using the files contained in the ``docs/source/examples/Notebook`` directory of that Git repository. The base image which the files will be combined with is ``jupyter/minimal-notebook:latest``, but you can specify any of the Jupyter Project ``docker-stacks`` images as the base image.
|
This example command will pull down the Git repository <https://github.com/jupyter/notebook> and build the image `notebook-examples` using the files contained in the `docs/source/examples/Notebook` directory of that Git repository. The base image which the files will be combined with is `jupyter/minimal-notebook:latest`, but you can specify any of the Jupyter Project `docker-stacks` images as the base image.
|
||||||
|
|
||||||
The resulting image from running the command can be seen by running ``docker images``.
|
The resulting image from running the command can be seen by running `docker images` command:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
|
$ docker images
|
||||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
notebook-examples latest f5899ed1241d 2 minutes ago 2.59GB
|
notebook-examples latest f5899ed1241d 2 minutes ago 2.59GB
|
||||||
```
|
```
|
||||||
|
|
||||||
You can now run the image.
|
You can now run the image.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
$ docker run --rm -p 8888:8888 notebook-examples
|
$ docker run --rm -p 8888:8888 notebook-examples
|
||||||
Executing the command: jupyter notebook
|
Executing the command: jupyter notebook
|
||||||
[I 01:14:50.532 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
[I 01:14:50.532 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
|
||||||
@@ -69,15 +70,15 @@ Open your browser on the URL displayed, and you will find the notebooks from the
|
|||||||
The S2I Builder Scripts
|
The S2I Builder Scripts
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Normally when using S2I, the base image would be S2I enabled and contain the builder scripts needed to prepare the image and define how the application in the image should be run. As the Jupyter Project ``docker-stacks`` images are not S2I enabled (although they could be), in the above example the ``--scripts-url`` option has been used to specify that the example builder scripts contained in this directory of this Git repository should be used.
|
Normally when using S2I, the base image would be S2I enabled and contain the builder scripts needed to prepare the image and define how the application in the image should be run. As the Jupyter Project `docker-stacks` images are not S2I enabled (although they could be), in the above example the `--scripts-url` option has been used to specify that the example builder scripts contained in this directory of this Git repository should be used.
|
||||||
|
|
||||||
Using the ``--scripts-url`` option, the builder scripts can be hosted on any HTTP server, or you could also use builder scripts local to your computer file using an appropriate ``file://`` format URI argument to ``--scripts-url``.
|
Using the `--scripts-url` option, the builder scripts can be hosted on any HTTP server, or you could also use builder scripts local to your computer file using an appropriate `file://` format URI argument to `--scripts-url`.
|
||||||
|
|
||||||
The builder scripts in this directory of this repository are ``assemble`` and ``run`` and are provided as examples of what can be done. You can use the scripts as is, or create your own.
|
The builder scripts in this directory of this repository are `assemble` and `run` and are provided as examples of what can be done. You can use the scripts as is, or create your own.
|
||||||
|
|
||||||
The supplied ``assemble`` script performs a few key steps.
|
The supplied `assemble` script performs a few key steps.
|
||||||
|
|
||||||
The first steps copy files into the location they need to be when the image is run, from the directory where they are initially placed by the ``s2i`` command.
|
The first steps copy files into the location they need to be when the image is run, from the directory where they are initially placed by the `s2i` command.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp -Rf /tmp/src/. /home/$NB_USER
|
cp -Rf /tmp/src/. /home/$NB_USER
|
||||||
@@ -98,7 +99,7 @@ else
|
|||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
This determines whether a ``environment.yml`` or ``requirements.txt`` file exists with the files and if so, runs the appropriate package management tool to install any Python packages listed in those files.
|
This determines whether a `environment.yml` or `requirements.txt` file exists with the files and if so, runs the appropriate package management tool to install any Python packages listed in those files.
|
||||||
|
|
||||||
This means that so long as a set of notebook files provides one of these files listing what Python packages they need, those packages will be automatically installed into the image so they are available when the image is run.
|
This means that so long as a set of notebook files provides one of these files listing what Python packages they need, those packages will be automatically installed into the image so they are available when the image is run.
|
||||||
|
|
||||||
@@ -109,11 +110,11 @@ fix-permissions $CONDA_DIR
|
|||||||
fix-permissions /home/$NB_USER
|
fix-permissions /home/$NB_USER
|
||||||
```
|
```
|
||||||
|
|
||||||
This fixes up permissions on any new files created by the build. This is necessary to ensure that when the image is run, you can still install additional files. This is important for when an image is run in ``sudo`` mode, or it is hosted in a more secure container platform such as Kubernetes/OpenShift where it will be run as a set user ID that isn't known in advance.
|
This fixes up permissions on any new files created by the build. This is necessary to ensure that when the image is run, you can still install additional files. This is important for when an image is run in `sudo` mode, or it is hosted in a more secure container platform such as Kubernetes/OpenShift where it will be run as a set user ID that isn't known in advance.
|
||||||
|
|
||||||
As long as you preserve the first and last set of steps, you can do whatever you want in the ``assemble`` script to install packages, create files etc. Do be aware though that S2I builds do not run as ``root`` and so you cannot install additional system packages. If you need to install additional system packages, use a ``Dockerfile`` and normal ``docker build`` to first create a new custom base image from the Jupyter Project ``docker-stacks`` images, with the extra system packages, and then use that image with the S2I build to combine your notebooks and have Python packages installed.
|
As long as you preserve the first and last set of steps, you can do whatever you want in the `assemble` script to install packages, create files etc. Do be aware though that S2I builds do not run as `root` and so you cannot install additional system packages. If you need to install additional system packages, use a `Dockerfile` and normal `docker build` to first create a new custom base image from the Jupyter Project `docker-stacks` images, with the extra system packages, and then use that image with the S2I build to combine your notebooks and have Python packages installed.
|
||||||
|
|
||||||
The ``run`` script in this directory is very simple and just runs the notebook application.
|
The `run` script in this directory is very simple and just runs the notebook application.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
exec start-notebook.sh "$@"
|
exec start-notebook.sh "$@"
|
||||||
@@ -135,7 +136,7 @@ jupyter-notebook-builder
|
|||||||
jupyter-notebook-quickstart
|
jupyter-notebook-quickstart
|
||||||
```
|
```
|
||||||
|
|
||||||
The templates can be used from the OpenShift web console or command line. This ``README`` is only going to explain deploying from the command line.
|
The templates can be used from the OpenShift web console or command line. This `README` is only going to explain deploying from the command line.
|
||||||
|
|
||||||
To use the OpenShift command line to build into an image, and deploy, the set of notebooks used above, run:
|
To use the OpenShift command line to build into an image, and deploy, the set of notebooks used above, run:
|
||||||
|
|
||||||
@@ -148,21 +149,17 @@ oc new-app --template jupyter-notebook-quickstart \
|
|||||||
--param NOTEBOOK_PASSWORD=mypassword
|
--param NOTEBOOK_PASSWORD=mypassword
|
||||||
```
|
```
|
||||||
|
|
||||||
You can provide a password using the ``NOTEBOOK_PASSWORD`` parameter. If you don't set that parameter, a password will be generated, with it being displayed by the ``oc new-app`` command.
|
You can provide a password using the `NOTEBOOK_PASSWORD` parameter. If you don't set that parameter, a password will be generated, with it being displayed by the `oc new-app` command.
|
||||||
|
|
||||||
Once the image has been built, it will be deployed. To see the hostname for accessing the notebook, run ``oc get routes``.
|
Once the image has been built, it will be deployed. To see the hostname for accessing the notebook, run `oc get routes`.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
|
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
|
||||||
notebook-examples notebook-examples-jupyter.abcd.pro-us-east-1.openshiftapps.com notebook-examples 8888-tcp edge/Redirect None
|
notebook-examples notebook-examples-jupyter.abcd.pro-us-east-1.openshiftapps.com notebook-examples 8888-tcp edge/Redirect None
|
||||||
```
|
```
|
||||||
|
|
||||||
As the deployment will use a secure connection, the URL for accessing the notebook in this case would be:
|
As the deployment will use a secure connection, the URL for accessing the notebook in this case would be <https://notebook-examples-jupyter.abcd.pro-us-east-1.openshiftapps.com>.
|
||||||
|
|
||||||
```
|
If you only want to build an image but not deploy it, you can use the `jupyter-notebook-builder` template. You can then deploy it using the `jupyter-notebook` template provided with the [openshift](../openshift) examples directory.
|
||||||
https://notebook-examples-jupyter.abcd.pro-us-east-1.openshiftapps.com
|
|
||||||
```
|
|
||||||
|
|
||||||
If you only want to build an image but not deploy it, you can use the ``jupyter-notebook-builder`` template. You can then deploy it using the ``jupyter-notebook`` template provided with the [openshift](../openshift) examples directory.
|
See the `openshift` examples directory for further information on customizing configuration for a Jupyter Notebook deployment and deleting a deployment.
|
||||||
|
|
||||||
See the ``openshift`` examples directory for further information on customizing configuration for a Jupyter Notebook deployment and deleting a deployment.
|
|
||||||
|
Reference in New Issue
Block a user