mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-18 15:32:56 +00:00
Updated to reduce image size of minimal kernel
Contribution (c) Copyright IBM Corp. 2016
This commit is contained in:
@@ -8,16 +8,15 @@ USER root
|
|||||||
# Install all OS dependencies for fully functional notebook server
|
# Install all OS dependencies for fully functional notebook server
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN apt-get update && apt-get install -yq --no-install-recommends \
|
RUN apt-get update && apt-get install -yq --no-install-recommends \
|
||||||
git \
|
|
||||||
vim \
|
|
||||||
wget \
|
wget \
|
||||||
build-essential \
|
build-essential \
|
||||||
python-dev \
|
python3-dev \
|
||||||
|
python3-pip \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
unzip \
|
unzip \
|
||||||
libsm6 \
|
libsm6 \
|
||||||
pandoc \
|
python3-zmq \
|
||||||
sudo \
|
sudo \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
|
|
||||||
@@ -28,45 +27,30 @@ RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.6.0/tini &
|
|||||||
chmod +x /usr/local/bin/tini
|
chmod +x /usr/local/bin/tini
|
||||||
|
|
||||||
# Configure environment
|
# Configure environment
|
||||||
ENV CONDA_DIR /opt/conda
|
|
||||||
ENV PATH $CONDA_DIR/bin:$PATH
|
|
||||||
ENV SHELL /bin/bash
|
ENV SHELL /bin/bash
|
||||||
ENV NB_USER jovyan
|
ENV NB_USER jovyan
|
||||||
ENV NB_UID 1000
|
ENV NB_UID 1000
|
||||||
|
|
||||||
# Install conda
|
|
||||||
RUN mkdir -p $CONDA_DIR && \
|
|
||||||
echo export PATH=$CONDA_DIR/bin:'$PATH' > /etc/profile.d/conda.sh && \
|
|
||||||
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \
|
|
||||||
echo "6c6b44acdd0bc4229377ee10d52c8ac6160c336d9cdd669db7371aa9344e1ac3 *Miniconda3-3.9.1-Linux-x86_64.sh" | sha256sum -c - && \
|
|
||||||
/bin/bash /Miniconda3-3.9.1-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
|
|
||||||
rm Miniconda3-3.9.1-Linux-x86_64.sh && \
|
|
||||||
$CONDA_DIR/bin/conda install --yes conda==3.14.1
|
|
||||||
|
|
||||||
# Create jovyan user with UID=1000 and in the 'users' group
|
# Create jovyan user with UID=1000 and in the 'users' group
|
||||||
# Grant ownership over the conda dir and home dir, but stick the group as root.
|
# Grant ownership over the home dir, but stick the group as root.
|
||||||
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
|
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
|
||||||
mkdir /home/$NB_USER/work && \
|
mkdir /home/$NB_USER/work && \
|
||||||
mkdir /home/$NB_USER/.jupyter && \
|
mkdir /home/$NB_USER/.jupyter && \
|
||||||
mkdir /home/$NB_USER/.local && \
|
mkdir /home/$NB_USER/.local && \
|
||||||
chown -R $NB_USER:users $CONDA_DIR && \
|
|
||||||
chown -R $NB_USER:users /home/$NB_USER
|
chown -R $NB_USER:users /home/$NB_USER
|
||||||
|
|
||||||
# Install Kernel Gateway
|
# Install Kernel Gateway
|
||||||
RUN cd /tmp && \
|
RUN pip3 install jupyter_kernel_gateway==0.2.0
|
||||||
git clone https://github.com/jupyter-incubator/kernel_gateway.git && \
|
|
||||||
cd kernel_gateway && \
|
|
||||||
python setup.py sdist && \
|
|
||||||
pip install dist/jupyter_kernel_gateway-*.tar.gz && \
|
|
||||||
rm -rf /tmp/kernel_gateway
|
|
||||||
|
|
||||||
# Configure container startup
|
# Configure container startup
|
||||||
|
USER $NB_USER
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
WORKDIR /home/$NB_USER/work
|
WORKDIR /home/$NB_USER/work
|
||||||
ENTRYPOINT ["tini", "--"]
|
ENTRYPOINT ["tini", "--"]
|
||||||
CMD ["start.sh"]
|
CMD ["/usr/local/bin/start-notebook.sh"]
|
||||||
|
|
||||||
# Add local files as late as possible to avoid cache busting
|
# Add local files as late as possible to avoid cache busting
|
||||||
COPY start.sh /usr/local/bin/
|
USER root
|
||||||
|
COPY start-notebook.sh /usr/local/bin/
|
||||||
COPY jupyter_kernel_gateway_config.py /home/$NB_USER/.jupyter/
|
COPY jupyter_kernel_gateway_config.py /home/$NB_USER/.jupyter/
|
||||||
RUN chown -R $NB_USER:users /home/$NB_USER/.jupyter
|
RUN chown -R $NB_USER:users /home/$NB_USER/.jupyter
|
||||||
|
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
## What it Gives You
|
## What it Gives You
|
||||||
* [Jupyter Kernel Gateway](https://github.com/jupyter-incubator/kernel_gateway) that spawns minimal Jupyter Python kernel
|
* [Jupyter Kernel Gateway](https://github.com/jupyter-incubator/kernel_gateway) that spawns minimal Jupyter Python kernel
|
||||||
* Conda Python 3.4.x
|
|
||||||
* No preinstalled scientific computing packages
|
* No preinstalled scientific computing packages
|
||||||
* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan` and `/opt/conda`
|
* Unprivileged user `jovyan` (uid=1000, configurable, see options) in group `users` (gid=100) with ownership over `/home/jovyan`
|
||||||
* [tini](https://github.com/krallin/tini) as the container entrypoint and [start.sh](./start.sh) as the default command
|
* [tini](https://github.com/krallin/tini) as the container entrypoint and [start.sh](./start.sh) as the default command
|
||||||
* Options for Port and Ip address
|
* Options for Port and Ip address
|
||||||
|
|
||||||
@@ -22,8 +21,4 @@ docker run -d -p 8888:8888 jupyter/minimal-kernel
|
|||||||
You may customize the execution of the Docker container and the Notebook server it contains with the following optional arguments.
|
You may customize the execution of the Docker container and the Notebook server it contains with the following optional arguments.
|
||||||
|
|
||||||
* `-e INTERFACE=10.10.10.10` - Configures Kernel Gateway to listen on the given interface. Defaults to '0.0.0.0', all interfaces, which is appropriate when running using default bridged Docker networking. When using Docker's `--net=host`, you may wish to use this option to specify a particular network interface.
|
* `-e INTERFACE=10.10.10.10` - Configures Kernel Gateway to listen on the given interface. Defaults to '0.0.0.0', all interfaces, which is appropriate when running using default bridged Docker networking. When using Docker's `--net=host`, you may wish to use this option to specify a particular network interface.
|
||||||
* `-e PORT=8888` - Configures Kernel Gateway to listen on the given port. Defaults to 8888, which is the port exposed within the Dockerfile for the image. When using Docker's `--net=host`, you may wish to use this option to specify a particular port.
|
* `-e PORT=8888` - Configures Kernel Gateway to listen on the given port. Defaults to 8888, which is the port exposed within the Dockerfile for the image. When using Docker's `--net=host`, you may wish to use this option to specify a particular port.
|
||||||
|
|
||||||
## Conda Environment
|
|
||||||
|
|
||||||
The default Python 3.x [Conda environment](http://conda.pydata.org/docs/using/envs.html) resides in `/opt/conda`. The commands `ipython`, `python`, `pip`, `easy_install`, and `conda` (among others) are available in this environment.
|
|
1
minimal-kernel/start.sh → minimal-kernel/start-notebook.sh
Executable file → Normal file
1
minimal-kernel/start.sh → minimal-kernel/start-notebook.sh
Executable file → Normal file
@@ -3,7 +3,6 @@
|
|||||||
# Change UID of NB_USER to NB_UID if it does not match
|
# Change UID of NB_USER to NB_UID if it does not match
|
||||||
if [ "$NB_UID" != $(id -u $NB_USER) ] ; then
|
if [ "$NB_UID" != $(id -u $NB_USER) ] ; then
|
||||||
usermod -u $NB_UID $NB_USER
|
usermod -u $NB_UID $NB_USER
|
||||||
chown -R $NB_UID $CONDA_DIR
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable sudo if requested
|
# Enable sudo if requested
|
Reference in New Issue
Block a user