TensorFlow on Windows 10 Using Docker Installation Method

TensorFlow on Windows 10 Using Docker Installation Method

I am taking an online course of Deep Learning now and it requires me to use TensorFlow. I spent a lot of time searching around, testing different things, and finally managed to run TensorFlow on my windows 10 laptop. So I think maybe I should write a post to remind myself, just in case I need to do it again in the future. And I hope this post can save someone else’s time too.

The overview section of Download and Setup page says there are four different ways to install TensorFlow:

  1. Pip install
  2. Virtualenv install
  3. Anaconda install
  4. Docker install

Since I have heard about docker for a while but never get a chance to use it, I think it is a great opportunity for me to learn how to use docker. So I chose the Docker install method here. It looks pretty simple, only three steps.

steps

However, these three steps took me a whole morning…

First, I went to the Install Docker for Windows page and followed the instructions. I have no idea about whether the virtualization is enabled or not on my laptop, and my Task Manager looks different with the image shown on the instruction page.

Task Manager

I struggled with this and the BIOS for a while and found out that the virtualization IS enabled from the System Information (by runing msinfo32 command).

msinfo32

Next, I installed the Docker Toolbox since I am pretty sure I am use a 64-bit Windows. This process is very easy and straightforward. After installing Docker Toolbox, three more icons showed up on my desktop.

short cuts

I launched the Docker Toolbox terminal by double-clicking the Quickstart Terminal icon and made my very first docker command: “docker run hello-world“. So far so good.

terminal

 

So now I have finished the first step: “Install Docker on your machine“. But I had no idea how to do the second step: “Create a Docker group to allow launching containers without sudo“.  And the big lesson I learned here is that, this second step is NOT necessary, at least in my case. I skipped this step and went ahead to the third step: “Launch a Docker container with the TensorFlow image“.

I first tried “$ docker run it gcr.io/tensorflow/tensorflow” and everything looked good from the terminal, which said “The Jupyter Notebook is running at http://[all ip addresses on your system]:8888/“. Wait, what are “all ip addresses”? I typed in “localhost:8888” in my Chrome browser address bar but the Jupyter Notebook did not load…

localhost not working

Once again, a post on stackoverflow is my life-saver. I followed the answer and everything worked out. First I ran the command “$ docker-machine ip default” and figured out the ip address should be 192.168.99.100. Then I started the TensorFlow docker container again by using command “$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow“. Now the Jupyter Notebook is working at 192.168.99.100:8888.

Capture10

I opened the first notebook and made a test run on the first cell. It worked!

This is how I installed TensorFlow on my laptop via Docker. I hope it is useful to you. Feel free to leave your comments or questions below!

 

3 thoughts on “TensorFlow on Windows 10 Using Docker Installation Method

  1. Hey Shishu,

    thank you very much for sharing this!
    I’m a complete noob to terminals, docker, even python and Machine Learning generally, so I spend close to a day trying to set up tensorflow in my ipython notebook with a windows 8 machine. Finally I got it due to your mentioned procedure!

    One question: Do you have to execute the command “$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow“ each time when using tensorflow?

    Thanks!

    1. Hi Jannis, yes that is one way to use TensorFlow again. However, if you use this method, you might want to use ‘data volume’ to save your work. Otherwise every time when you execute the command “$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow“, you actually create a brand new container. Let me know how it works for you.

Leave a Reply

Your email address will not be published. Required fields are marked *