diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 25340724b7..c036076d36 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -46,6 +46,7 @@ ARG miniforge_checksum="d4065b376f81b83cfef0c7316f97bb83337e4ae27eb988828363a578 ENV DEBIAN_FRONTEND noninteractive RUN apt-get -q update && \ apt-get install -yq --no-install-recommends \ + tini \ wget \ ca-certificates \ sudo \ @@ -115,10 +116,8 @@ RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${m conda list python | grep '^python ' | tr -s ' ' | cut -d '.' -f 1,2 | sed 's/$/.*/' >> $CONDA_DIR/conda-meta/pinned && \ conda install --quiet --yes \ "conda=${CONDA_VERSION}" \ - 'pip' \ - 'tini=0.18.0' && \ + 'pip' && \ conda update --all --quiet --yes && \ - conda list tini | grep tini | tr -s ' ' | cut -d ' ' -f 1,2 >> $CONDA_DIR/conda-meta/pinned && \ conda clean --all -f -y && \ rm -rf /home/$NB_USER/.cache/yarn && \ fix-permissions $CONDA_DIR && \ diff --git a/base-notebook/test/test_start_script.py b/base-notebook/test/test_start_container.py similarity index 58% rename from base-notebook/test/test_start_script.py rename to base-notebook/test/test_start_container.py index 8b3f975935..f55b55f681 100644 --- a/base-notebook/test/test_start_script.py +++ b/base-notebook/test/test_start_container.py @@ -8,11 +8,7 @@ @pytest.mark.parametrize( - "env,expected_server", - [ - (["JUPYTER_ENABLE_LAB=yes"], "lab"), - (None, "notebook"), - ], + "env,expected_server", [(["JUPYTER_ENABLE_LAB=yes"], "lab"), (None, "notebook"), ], ) def test_start_notebook(container, http_client, env, expected_server): """Test the notebook start-notebook script""" @@ -31,3 +27,17 @@ def test_start_notebook(container, http_client, env, expected_server): if not env: msg = "WARN: Jupyter Notebook deprecation notice" assert msg in logs, f"Expected warning message {msg} not printed" + + +def test_tini_entrypoint(container, pid=1, command="tini"): + """Check that tini is launched as PID 1 + + Credits to the following answer for the ps options used in the test: + https://superuser.com/questions/632979/if-i-know-the-pid-number-of-a-process-how-can-i-get-its-name + """ + LOGGER.info(f"Test that {command} is launched as PID {pid} ...") + c = container.run(tty=True, command=["start.sh"]) + # Select the PID 1 and get the corresponding command + cmd = c.exec_run(f"ps -p {pid} -o comm=") + output = cmd.output.decode("utf-8").strip("\n") + assert output == command, f"{command} shall be launched as pid {pid}, got {output}" diff --git a/docs/using/selecting.md b/docs/using/selecting.md index 177cb6d8a8..9b6180b72a 100644 --- a/docs/using/selecting.md +++ b/docs/using/selecting.md @@ -238,7 +238,7 @@ core images and link them below. **nvidia/cuda** base image, the well-maintained **docker-stacks** that is integrated as submodule and GPU-able libraries like **Tensorflow**, **Keras** and **PyTorch** on top of it. -- [PRP GPU Jupyter repo](https://gitlab.nautilus.optiputer.net/prp/jupyter-stack/-/tree/prp) and [Registry](https://gitlab.nautilus.optiputer.net/prp/jupyter-stack/container_registry): PRP (Pacific Research Platform) maintained registry for jupyter stack based on NVIDIA CUDA-enabled image. Added the PRP image with Pytorch and some other python packages, and GUI Desktop notebook based on https://github.com/jupyterhub/jupyter-remote-desktop-proxy. +- [PRP GPU Jupyter repo](https://gitlab.nautilus.optiputer.net/prp/jupyter-stack/-/tree/prp) and [Registry](https://gitlab.nautilus.optiputer.net/prp/jupyter-stack/container_registry): PRP (Pacific Research Platform) maintained registry for jupyter stack based on NVIDIA CUDA-enabled image. Added the PRP image with Pytorch and some other python packages, and GUI Desktop notebook based on . - [cgspatial-notebook](https://github.com/SCiO-systems/cgspatial-notebook) is a community Jupyter Docker Stack image. The image includes major geospatial Python & R libraries on top of the