CS 6501-003: Computational Visual Recognition

Using iTorch through Docker

The following instructions were compiled by Ian Zheng while working on the first lab and reposted here with his permission. This will allow users to bypass the need of installing all iTorch dependencies themselves as well as Windows users to complete the labs. Docker can be thought as a very light-weight virtual machine (Read more here https://www.docker.com/what-docker). Here are the steps:

  1. Installing Docker depending on your OS
    Ubuntu: https://docs.docker.com/installation/ubuntulinux/
    Mac: https://docs.docker.com/docker-for-mac/
    Windows: https://docs.docker.com/docker-for-windows/
    More OS options available: https://docs.docker.com/engine/installation/
    This step should be straightforward, but you may encounter problem like insufficient machine memory so docker for Mac cannot be installed. In that case you can try installing Docker Machine. After Docker is installed, your life will be much easier.

  2. Pull down the iTorch Docker image
    In your terminal
    docker pull kaixhin/torch

  3. Stand up the iTorch instance
    docker run -it --rm -p 8888:8888 dhunter/itorch-notebook
    And that's it!

  4. Try iTorch in your browser!
    Go to localhost:8888 if you are using Linux Docker or Docker for Mac/Window. If you end up using Docker Machine, go to <docker VM's IP Address(on the top under the whale when you bring up the Docker QuickStart Terminal)>:8888

  5. Finally, to persist data (your notebooks, images, etc) using Docker:
    By specifying the --rm flag, the container will be removed upon exit. All the files created inside the container will also be deleted. The easiest way to persist data outside container's lifetime is to specify the -v flag. -v is called volume tag. You docker run command will then look something like this

    docker run -it --rm -p 8888:8888 -v ~/Documents/projects/CV_recognition/notebook:/root/dev dhunter/itorch-notebook

    In the example, the -v flag tells docker to mount /root/dev in the container onto ~/Documents/projects/CV_recognition/notebook directory on the host machine (my mac). By using the -v flag, all the change you made will be saved directly to the file system on your host machine. It also works the other way round. To import a file to Jupyter, simply copy it to the directory on you host machine and the container will automatically pick up the change!