Jupyter Keras Quickstart

Updated at 2017-09-10 12:34

How to get temp Jupyter Notebook running locally using Docker for quick hacking.

# Create directory to store files.
mkdir ~/Projects/notebook

# Start docker container from Jupyter image in the background
docker run -d --rm --name jupyter -p 8888:8888 \
    -e KERAS_BACKEND=theano \
    -v ~/Projects/notebook:/notebook ermaker/keras-jupyter \
    jupyter notebook --no-browser --ip= --allow-root --NotebookApp.token=

# Now you can access Jupyter through web browser.
open http://localhost:8888

If you want to install something inside the container.

docker exec jupyter conda install -y scikit-learn

# or

docker exec -it jupyter /bin/bash
# ...

Create new notebook inside Jupyter and check that it works ok.

import sys
print('Python: {}'.format(sys.version))

import numpy
print('numpy: {}'.format(numpy.__version__))

import pandas
print('pandas: {}'.format(pandas.__version__))

import matplotlib
print('matplotlib: {}'.format(matplotlib.__version__))

import scipy
print('scipy: {}'.format(scipy.__version__))

To stop and remove the container.

docker stop jupyter

If you want to have something available installed, extend the Dockerfile and rebuild the image.