Files
docker-stacks/minimal-notebook/Dockerfile
Peter Parente dba9977525 Create jovyan in Dockerfile, reset UID at startup
* Create user jovyan with UID=1000 in the default users group in the Dockerfile
* Set group ownership of user home and conda to root to avoid 'users' group from host access when mounted
* Set stick bit on both paths so root owns subdirs too
* Change jovyan UID if NB_UID is specified and is not the default 1000

Contribution (c) Copyright IBM Corp. 2015
2015-09-10 23:46:31 -04:00

68 lines
1.9 KiB
Docker

# Copyright (c) Jupyter Development Team.
FROM debian:jessie
MAINTAINER Jupyter Project <jupyter@googlegroups.com>
USER root
# Install all OS dependencies for fully functional notebook server
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -yq --no-install-recommends \
git \
vim \
wget \
build-essential \
python-dev \
ca-certificates \
bzip2 \
unzip \
libsm6 \
pandoc \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-extra \
texlive-fonts-recommended \
supervisor \
sudo \
&& apt-get clean
# Configure environment
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
ENV NB_USER jovyan
ENV NB_UID 1000
# Install conda
RUN mkdir -p $CONDA_DIR && \
chmod g+s $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 && \
/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
# Install Jupyter notebook
RUN conda install --yes \
'notebook=4.0*' \
terminado \
&& conda clean -yt
# 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.
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
chmod g+s /home/$NB_USER && \
mkdir /home/$NB_USER/work && \
mkdir /home/$NB_USER/.jupyter && \
mkdir /home/$NB_USER/.local && \
chown -R $NB_USER:root $CONDA_DIR && \
chown -R $NB_USER:root /home/$NB_USER
# Configure container startup
EXPOSE 8888
CMD [ "start-notebook.sh" ]
# Add local files as late as possible to avoid cache busting
COPY start-notebook.sh /usr/local/bin/
COPY notebook.conf /etc/supervisor/conf.d/
COPY jupyter_notebook_config.py /home/$NB_USER/.jupyter/
RUN chown -R $NB_USER:root /home/$NB_USER/.jupyter