mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Merge pull request #530 from jakirkham/use_tini
Use `tini` in Dockerfile for zombie process reaping
This commit is contained in:
commit
a925892b35
85
Dockerfile
85
Dockerfile
@ -11,10 +11,11 @@ MAINTAINER Project Jupyter <jupyter@googlegroups.com>
|
||||
ENV LANGUAGE en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
ENV PYTHONIOENCODING UTF-8
|
||||
|
||||
# Python binary and source dependencies
|
||||
RUN apt-get update -qq \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
|
||||
RUN apt-get update -qq && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
@ -31,44 +32,58 @@ RUN apt-get update -qq \
|
||||
texlive-fonts-recommended \
|
||||
texlive-latex-base \
|
||||
texlive-latex-extra \
|
||||
zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
\
|
||||
`# Install the recent pip release` \
|
||||
&& curl -O https://bootstrap.pypa.io/get-pip.py \
|
||||
&& python2 get-pip.py \
|
||||
&& python3 get-pip.py \
|
||||
&& rm get-pip.py \
|
||||
\
|
||||
&& pip2 --no-cache-dir install ipykernel \
|
||||
&& pip3 --no-cache-dir install ipykernel
|
||||
zlib1g-dev && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Tini
|
||||
RUN curl -L https://github.com/krallin/tini/releases/download/v0.6.0/tini > tini && \
|
||||
echo "d5ed732199c36a1189320e6c4859f0169e950692f451c03e7854243b95f4234b *tini" | sha256sum -c - && \
|
||||
mv tini /usr/local/bin/tini && \
|
||||
chmod +x /usr/local/bin/tini
|
||||
|
||||
# Install the recent pip release
|
||||
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
|
||||
python2 get-pip.py && \
|
||||
python3 get-pip.py && \
|
||||
rm get-pip.py
|
||||
|
||||
# Install some dependencies.
|
||||
RUN pip2 --no-cache-dir install ipykernel && \
|
||||
pip3 --no-cache-dir install ipykernel && \
|
||||
\
|
||||
python2 -m ipykernel.kernelspec && \
|
||||
python3 -m ipykernel.kernelspec
|
||||
|
||||
# Move notebook contents into place.
|
||||
ADD . /usr/src/jupyter-notebook
|
||||
|
||||
RUN ln -s /usr/src/jupyter-notebook/scripts/lxc-launcher.sh /launch.sh \
|
||||
\
|
||||
&& BUILD_DEPS="nodejs-legacy npm" \
|
||||
&& apt-get update -qq \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends $BUILD_DEPS \
|
||||
\
|
||||
&& pip3 install --no-cache-dir --pre -e /usr/src/jupyter-notebook \
|
||||
\
|
||||
&& apt-get purge -y --auto-remove \
|
||||
-o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
\
|
||||
&& python2 -m ipykernel.kernelspec \
|
||||
&& python3 -m ipykernel.kernelspec \
|
||||
\
|
||||
&& pip2 install --no-cache-dir mock nose requests testpath \
|
||||
&& pip3 install --no-cache-dir nose requests testpath \
|
||||
&& iptest2 && iptest3 \
|
||||
&& pip2 uninstall -y funcsigs mock nose pbr requests six testpath \
|
||||
&& pip3 uninstall -y nose requests testpath
|
||||
# Install dependencies and run tests.
|
||||
RUN BUILD_DEPS="nodejs-legacy npm" && \
|
||||
apt-get update -qq && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yq $BUILD_DEPS && \
|
||||
\
|
||||
pip3 install --no-cache-dir --pre -e /usr/src/jupyter-notebook && \
|
||||
\
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yq $BUILD_DEPS && \
|
||||
apt-get purge -y --auto-remove \
|
||||
-o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $BUILD_DEPS
|
||||
|
||||
# Run tests.
|
||||
RUN pip2 install --no-cache-dir mock nose requests testpath && \
|
||||
pip3 install --no-cache-dir nose requests testpath && \
|
||||
\
|
||||
iptest2 && iptest3 && \
|
||||
\
|
||||
pip2 uninstall -y funcsigs mock nose pbr requests six testpath && \
|
||||
pip3 uninstall -y nose requests testpath
|
||||
|
||||
VOLUME /notebooks
|
||||
WORKDIR /notebooks
|
||||
|
||||
ENTRYPOINT /launch.sh
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
CMD ["jupyter", "notebook", "--port", "8888", "--ip=*"]
|
||||
|
38
README.md
38
README.md
@ -6,7 +6,34 @@
|
||||
|
||||
The Jupyter HTML notebook is a web-based notebook environment for interactive computing.
|
||||
|
||||
Dev quickstart:
|
||||
## Usage
|
||||
|
||||
### Local installation
|
||||
|
||||
Launch with:
|
||||
|
||||
$ jupyter notebook
|
||||
|
||||
### In a Docker container
|
||||
|
||||
If you have a [Docker daemon running](https://docs.docker.com/installation/), e.g. reachable on `localhost`, start a container with:
|
||||
|
||||
$ docker run --rm -itP -v "$(pwd):/notebooks" jupyter/notebook
|
||||
|
||||
In your browser open the URL `http://localhost:8888/`.
|
||||
All notebooks from your session will be saved in the current directory.
|
||||
|
||||
On other platforms without `docker`, this can be started using `docker-machine`
|
||||
by replacing `localhost` with an IP from [`docker-machine ip <MACHINE>`](https://docs.docker.com/machine/reference/ip/).
|
||||
With the deprecated `boot2docker`, this IP will be `boot2docker ip`.
|
||||
|
||||
## Installation
|
||||
|
||||
For a local installation, make sure you have [pip installed](https://pip.readthedocs.org/en/stable/installing/) and run:
|
||||
|
||||
$ pip install notebook
|
||||
|
||||
### Dev quickstart
|
||||
|
||||
* ensure that you have node/npm installed (e.g. `brew install node` on OS X)
|
||||
* Clone this repo and cd into it
|
||||
@ -15,11 +42,7 @@ Dev quickstart:
|
||||
_NOTE_: For Debian/Ubuntu systems, if you're installing the system node you need
|
||||
to use the 'nodejs-legacy' package and not the 'node' package.
|
||||
|
||||
Launch with:
|
||||
|
||||
jupyter notebook
|
||||
|
||||
Example installation (tested on Ubuntu Trusty):
|
||||
### Ubuntu Trusty
|
||||
|
||||
```
|
||||
sudo apt-get install nodejs-legacy npm python-virtualenv python-dev
|
||||
@ -31,7 +54,8 @@ pip install --pre -e .
|
||||
jupyter notebook
|
||||
```
|
||||
|
||||
For FreeBSD:
|
||||
### FreeBSD
|
||||
|
||||
```
|
||||
cd /usr/ports/www/npm
|
||||
sudo make install # (Be sure to select the "NODE" option)
|
||||
|
@ -6,6 +6,11 @@ Jupyter notebook changelog
|
||||
A summary of changes in the Jupyter notebook.
|
||||
For more detailed information, see `GitHub <https://github.com/jupyter/notebook>`__.
|
||||
|
||||
4.1.x
|
||||
-----
|
||||
|
||||
- Properly handle reaping of zombie subprocesses.
|
||||
|
||||
4.0.x
|
||||
-----
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A wrapper script for running Jupyter notebook in a lxc-container that
|
||||
# addresses two issues:
|
||||
# - IPython kernels constantly crash when run with PID == 1
|
||||
# - send signals to the process for a proper shutdown when the container
|
||||
# receives a TERM signal
|
||||
|
||||
_terminate() {
|
||||
kill -SIGINT $PID
|
||||
kill -SIGINT $PID
|
||||
}
|
||||
|
||||
trap _terminate SIGTERM
|
||||
trap _terminate SIGINT
|
||||
|
||||
jupyter notebook --port 8888 --ip=* "${@}" &
|
||||
PID=$!
|
||||
|
||||
wait $PID
|
||||
exit $?
|
Loading…
Reference in New Issue
Block a user