Build a docker image

You may sometimes wish to customize your image.

# Dockerfile
FROM tensorflow/tensorflow:latest-jupyter
RUN pip install opencv-python-headless
CMD [ "bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root" ]
$ docker build -t mytest1 .
$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
mytest1                 latest              0c66acf727fa        14 minutes ago      1.82GB
tensorflow/tensorflow   latest-jupyter      2d87e2e84687        9 days ago          1.69GB
$ docker run -it -p 8888:8888 mytest1:latest

TensorFlow 2

Two quick and easy ways to use TensorFlow 2 are either to run a docker image or to visit Google Colab with your browser.

$ docker pull tensorflow/tensorflow:latest
$ docker run -it -p 8888:8888 tensorflow/tensorflow:latest-jupyter

The Prime Radiant

Do you think the Psychohistorians are discussing using Google Colab and TensorBoard?

It all began in the year 11,988 GE (Galactic Era) when Hari Seldon was born on Helicon.

Google Colab (None, GPU, TPU)

You can select two types of hardware accelerators.

Without a hardware accelerator, you will get:

But, with GPUs:

So it gets about six times faster with a GPU.


A sample program provided by Google shows twenty times acceleration with GPUs.

Another sample program shows the throughput of 162.58 TFlops with TPUs.

Google Colab

Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.

You can upload your Jupyter notebook and run the program in the cloud.

JupyterLab vs. PyCharm

JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data.

I prefer to use PyCharm myself, but in some situations JupyterLab could be the best choice.

Various types of docker images are available.

$ docker run --rm -p 10000:8888 -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/work jupyter/scipy-notebook:17aba6048f44