Docker: Tensorflow with Jupyter on Windows

If you want to use Tensorflow on a regular basis, there is no good performing alternative to using a native linux or Mac OS installation due to the lack of GPU support. Windows users who just want to take a glimpse at Tensorflow for learning or smaller research purposes however can do so easily by using Docker.

With the following setup, Tensorflow can be used on Windows hosts by using a docker-hostet Jupyter Notebook (former iPython Notebook) from the host browser with local .ipynb files.

Requirements

First, the following software has to be installed on the host. For those never worked with Docker, this short tutorial gives a good overview.

This setup tutorial is based on following path entries:

  • C:\Program Files\Docker Toolbox
  • C:\Program Files\Oracle\VirtualBox

1. Create and configure Docker-Machine

First we have to create and afterwards we configure a new local docker-machine.

Next we have to forward ports 8888 (Jupyter NB) and 6006 (TensorBoard) to be able to use Jupyter Notebook and TensorBoard host-sided:

Instead of using VBoxManage you can use VirtualBox Manager by clicking Docker-Machine-VM->Settings->Network-Port Forwarding.

vbox_port-forwarding

The next step is to share our hosts folder for .ipynb files. Therefore we have to stop the freshly created Docker-Machine and afterwards share the folder (in my case “jupyter_notebooks”) with the docker-machine by using the VBoxManage sharedfolder add command.

Like above, instead of VBoxManage you can use the VirtualBox Manager here: VM->Settings->Shared Folders->add

vbox_shared-folders

2. Start Docker-Machine and “wire up” the shared folders.

By using the following two commands, we start the preconfigured machine and connect to it via ssh.

Afterwards we create a target folder inside of the docker-machine and mount the previously shared folder.

Now you should be able to list the shared folders contents with

3. Run Docker

As last step we can now create our docker container. Like before we forward ports 8888 and 6006 to the container by using the -p flag and again we share our folder by using -v. the source for our container is b.gcr.io/tensorflow/tensorflow from Google Container Registry. With -c we finally give the order to run Jupyter Notebook on our double-shared folder.

Once the sources are pulled, the container is created and Jupyter is started we can open the Notebook from our host browser with localhost:8888 and have Fun with Tensorflow.

 

Leave a Reply

Your email address will not be published.


*