Skip to content

Instantly share code, notes, and snippets.

@hohonuuli
Created May 11, 2018 20:05
Show Gist options
  • Save hohonuuli/ba6a233389944386c7eae397f45eba4f to your computer and use it in GitHub Desktop.
Save hohonuuli/ba6a233389944386c7eae397f45eba4f to your computer and use it in GitHub Desktop.
Dockerfile for a scipy setup using jupyter
FROM ubuntu
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
cmake \
&& rm -rf /var/lib/apt/lists/*
RUN curl -qsSLkO \
https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-`uname -p`.sh \
&& bash Miniconda3-latest-Linux-`uname -p`.sh -b \
&& rm Miniconda3-latest-Linux-`uname -p`.sh
ENV PATH=/root/miniconda3/bin:$PATH
RUN conda install -y \
h5py \
pandas \
jupyter \
matplotlib \
seaborn \
scikit-learn \
pandas
RUN conda config --append channels conda-forge
RUN conda install -y tensorflow keras
RUN conda clean --yes --tarballs --packages --source-cache
RUN apt-get update && apt-get install -y graphviz xvfb python-opengl
RUN pip install --upgrade pip && \
pip install graphviz xgboost
VOLUME /notebook
WORKDIR /notebook
EXPOSE 8888
CMD xvfb-run -s "-screen 0 1400x900x24" jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --NotebookApp.token=
@MBARIMike
Copy link

I thought I'd leave a comment in case another Docker newbie finds this gem, as it's not immediately clear how to use it.

Here's what I did on my Mac:

  1. Install Docker (https://www.docker.com/get-docker)
  2. mkdir ~/docker_notebook
  3. cd ~/docker_notebook
  4. Copy the gist contents into file Dockerfile
  5. docker build . -t notebook
  6. docker run -p 8888:8888 -v ~/docker_notebook:/notebook notebook

Then open a browser on the Mac pointing to http://localhost:8888. Any notebooks I save in the web interface will be in the ~/docker_notebook directory.

The output from the docker run ... command states Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). but that doesn't work. I needed to issue a docker stop <container_id> after getting the <container_id> from a docker ps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment