Setup Tensorflow on Windows using Docker


tensorflow docker

Tensorflow installed in docker (kitematic)

Just Started working on a project which use libraries including Tensorflow.

here are the steps to use Tensorflow on Windows (using Docker).

docker run -it -p 8888:8888 tensorflow/tensorflow

  • (optional) to mount a folder to tensorflow container, got to folder and run powershell command in that directory

docker run -it -p 8888:8888 -p 6006:6006 -v "$(pwd):/home" tensorflow/tensorflow

in case image is not downloaded previously(from terminal or kitematic), image will be downloaded automatically

where pwd is current current directory path and home is your mount point (can be any name)

note: make sure docker has permission to access drive. see post to mount drive.

  • this will start the conainter, just go to localhost:8888 to access the web ui.

Access bash, to run commands / program

(make sure to close existing conainer, like above one)

Tensorflow bash access in docker

  • start container docker start -i <conainer_name>
  • now to access the container, have to start bash. run

docker exec -it <name_or_id> bash

name or id is container name or id (see kitematic or run doker ps) to see name/id of container.

now you can run all linux commands to access files, programs in the container.


ls to list all files and folders in current directory

cd .. to go to parent directory.

python <file_name>.py to run python program

common issues:

  • scripts (specifically bash scripts) edited with windows have to fixed for encoding issue. run sed -i 's/\r$//' filename to fix encoding issue