Here are instructions to set up TensorFlow dev environment on Docker if you are running Windows, and configure it so that you can access Jupyter Notebook from within the VM + edit files in your text editor of choice on your Windows machine.
First, install https://www.docker.com/docker-toolbox
Since this is Windows, creating the Docker group "docker" is not necessary.
Open up "Docker Quickstart Terminal". It should bring up a MinGW-type shell. You could also use Windows cmd.exe or Powershell.exe but they haveadditional configurations that you need to do before you can run docker.exe
Launch the TensorFlow container. Set up port forwarding, mount contents of "thesis" directory into /home (the thesis folder doesn't show up, as its contents are mapped to the contents of /home.
$ docker run -it -p 8888:8888 -p 6006:6006 -v //c/Users/eric/Dropbox/thesis:/home b.gcr.io/tensorflow/tensorflow
The first time the command is run, it will Download and install TensorFlow. Afterwards, This should bring you into a Linux VM.
The command above mounts a folder in your Windows host machine into the container. It's preferable to do things this way, because the container does not persist your files by default.
It already comes with Jupyter installed, but you won't be able to access the notebooks by navigating to localhost:8888 (or whatever port Jupyter starts on). You will also want to expose port 6006 to be able to use TensorBoard (currently, exposing a port on a live container is not possible).
Instead, since it is running in a VM, not only do you need to forward the port (hence the -p 8888:8888), but the IP address you access needs to be the IP address of the VM, not the Windows Machine. Hence, you need to find the address of the docker machine running the container.
Listing the docker containers
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4dd413d71153 b.gcr.io/tensorflow/tensorflow "/bin/bash" 2 minutes ago Up 2 minutes 6006/tcp, 0.0.0.0:8888->8888/tcp lonely_engelbart
$ docker ps
docker-machine ls
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM ERRORS
default * virtualbox Running tcp://192.168.99.100:2376
$ docker-machine ip default
192.168.99.100
Navigate web browser to 192.168.99.100:8888
(or whatever webserver port your web app is running on) and you should be able to see your web apps.
Let's say you want to use this container for your research environment. You'll want to clone the docker container so you can make changes to it.
In the Docker Quickstart terminal,
docker pull b.gcr.io/tensorflow/tensorflow-full
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
b.gcr.io/tensorflow/tensorflow-full latest edc3d721078b 3 weeks ago 2.284 GB
b.gcr.io/tensorflow/tensorflow latest 217daf2537d2 4 weeks ago 652.6 MB
hello-world latest 0a6ba66e537a 7 weeks ago 960 B
Let's say you installed a python package like ipdb and want to commit changes. Just do:
docker commit lonely_engelbart ejang/tensorflow
Subsequently,
docker run ejang/tensorflow
If you want to attach another shell to the docker container:
docker exec -it lonely_engelbart bash
The docker-VM provided has default 1G memory, which is not sufficient to run the MNIST/CNN examples. You can configure the resource limits of the default Docker-machine VM from Virtualbox.
See this page for more tips: http://blog.pavelsklenar.com/5-useful-docker-tip-and-tricks-on-windows/
I'm running it like :
docker run -m 4g -d -it -p 8888:8888 -p 6006:6006 gcr.io/tensorflow/tensorflow
but when I execute:
http://localhost:8888/notebooks/3_mnist_from_scratch.ipynb
step 25 specifically. I got : "The kernel appears to have died. It will restart automatically."
I assume this has crashed because it doesn't have enough resources, how much resources and how can I allocate to Docker image?