1Assignments for Udacity Deep Learning class with TensorFlow
2===========================================================
3
4Course information can be found at https://www.udacity.com/course/deep-learning--ud730
5
6## Getting Started with Docker
7
8If you are new to Docker, follow
9[Docker document](https://docs.docker.com/machine/get-started/) to start a
10docker instance. Kindly read the requirements of Windows and Mac carefully.
11
12Running the Docker container from the Google Cloud repository
13-------------------------------------------------------------
14
15    docker run -p 8888:8888 --name tensorflow-udacity -it gcr.io/tensorflow/udacity-assignments:1.0.0
16
17Note that if you ever exit the container, you can return to it using:
18
19    docker start -ai tensorflow-udacity
20
21Accessing the Notebooks
22-----------------------
23
24On linux, go to: http://127.0.0.1:8888
25
26On mac, go to terminal and find the virtual machine's IP using:
27
28    docker-machine ip default
29
30Then go to: http://(ip address received from the above command):8888 (likely
31http://192.168.99.100:8888)
32
33On Windows, use powershell to find the virtual machine's IP using:
34
35    docker-machine ip default
36
37
38Then go to: http://(ip address received from the above command):8888 (likely
39http://192.168.99.100:8888)
40
41FAQ
42---
43
44* **I'm getting a MemoryError when loading data in the first notebook.**
45
46If you're using a Mac, Docker works by running a VM locally (which
47is controlled by `docker-machine`). It's quite likely that you'll
48need to bump up the amount of RAM allocated to the VM beyond the
49default (which is 1G).
50[This Stack Overflow question](http://stackoverflow.com/questions/32834082/how-to-increase-docker-machine-memory-mac)
51has two good suggestions; we recommend using 8G.
52
53In addition, you may need to pass `--memory=8g` as an extra argument to
54`docker run`.
55
56* **I want to create a new virtual machine instead of the default one.**
57
58`docker-machine` is a tool to provision and manage docker hosts, it supports multiple platform (ex. aws, gce, azure, virtualbox, ...). To create a new virtual machine locally with built-in docker engine, you can use
59
60    docker-machine create -d virtualbox --virtualbox-memory 8196 tensorflow
61
62`-d` means the driver for the cloud platform, supported drivers listed [here](https://docs.docker.com/machine/drivers/). Here we use virtualbox to create a new virtual machine locally. `tensorflow` means the name of the virtual machine, feel free to use whatever you like. You can use
63
64    docker-machine ip tensorflow
65
66to get the ip of the new virtual machine. To switch from default virtual machine to a new one (here we use tensorflow), type
67
68    eval $(docker-machine env tensorflow)
69
70Note that `docker-machine env tensorflow` outputs some environment variables such like `DOCKER_HOST`. Then your docker client is now connected to the docker host in virtual machine `tensorflow`
71
72* **I'm getting a TLS connection error.**
73
74If you get an error about the TLS connection of your docker, run the command below to confirm the problem.
75
76	docker-machine ip tensorflow
77
78Then if it is the case use the instructions on [this page](https://docs.docker.com/toolbox/faqs/troubleshoot/) to solve the issue.
79
80
81* **I'm getting the error - docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host? - when I run 'docker run'.**
82
83This is a permissions issue, and a popular answer is provided for Linux and Max OSX [here](http://stackoverflow.com/questions/21871479/docker-cant-connect-to-docker-daemon) on StackOverflow.
84
85Notes for anyone needing to build their own containers (mostly instructors)
86===========================================================================
87
88Building a local Docker container
89---------------------------------
90
91    cd tensorflow/examples/udacity
92    docker build --pull -t $USER/assignments .
93
94Running the local container
95---------------------------
96
97To run a disposable container:
98
99    docker run -p 8888:8888 -it --rm $USER/assignments
100
101Note the above command will create an ephemeral container and all data stored in the container will be lost when the container stops.
102
103To avoid losing work between sessions in the container, it is recommended that you mount the `tensorflow/examples/udacity` directory into the container:
104
105    docker run -p 8888:8888 -v </path/to/tensorflow/examples/udacity>:/notebooks -it --rm $USER/assignments
106
107This will allow you to save work and have access to generated files on the host filesystem.
108
109Pushing a Google Cloud release
110------------------------------
111
112    V=1.0.0
113    docker tag $USER/assignments gcr.io/tensorflow/udacity-assignments:$V
114    gcloud docker push gcr.io/tensorflow/udacity-assignments
115    docker tag $USER/assignments gcr.io/tensorflow/udacity-assignments:latest
116    gcloud docker push gcr.io/tensorflow/udacity-assignments
117
118History
119-------
120
121* 0.1.0: Initial release.
122* 0.2.0: Many fixes, including lower memory footprint and support for Python 3.
123* 0.3.0: Use 0.7.1 release.
124* 0.4.0: Move notMNIST data for Google Cloud.
125* 0.5.0: Actually use 0.7.1 release.
126* 0.6.0: Update to TF 0.10.0, add libjpeg (for Pillow).
127* 1.0.0: Update to TF 1.0.0 release.
128