Docker Notes for CS 159

Everything you need to run the assignments for this class is installed on knuth. However, if you’d like to use your own machine to work on the labs, you can use the course Docker image.

Over the course of the semester, many labs will require the use of external software libraries. Rather than figuring out how to install all of the libraries on your own computers, there is a Docker container that you can download. The container will contain all of code and libraries that you need for the semester. The container will be hosted on Docker cloud, so if there is a need to update the container, you will be able to easily pull the newest version from the cloud.

To get started, you will need to visit the Get Started with Docker page to download Docker Community Edition. You will need to login or create a free account Docker before you can download the software. After you’ve downloaded the software, follow the instructions to install it.

When your container is running, you will need to mount one of your local folders so that you can read/write files. Since you’ll be pulling git repos to your computer in order to complete the labs, it is a good idea to make a folder on your computer as the parent directory to hold each of the lab repos.

To run docker, use the following command (wrapped on to two lines for readability, but you should type this as a single line):

docker run -it -h docker -v /Users/julie/Documents/nlp:/home/student/nlp 
   harveymudd/cs159-student:spring2020 bash

If I was using Windows, I might have the following:

Notice that in the command below, even though the directory is called “My Documents”, Windows allows you to just call the folder “Documents” at the command line to avoid problems with spaces. Also notice that Windows allows you to use ‘normal’ Linux forward-slashes to specify the path (wrapped on to two lines for readability, but you should type this as a single line):

docker run -it -h docker -v C:/Users/julie/Documents/nlp:/home/student/nlp 
    harveymudd/cs159-student:spring2020 bash

You’re welcome to change the location of your top-level folder to anywhere you want on your computer, but leave the part after the colon (/nlp) the same.

Although the container has both emacs and vi installed, you will probably find that using a more modern editor installed locally on your machine is easier to use. Since you’re editing files that are local to your computer, a local editor (e.g. atom or Visual Studio Code) is likely a better choice.

Note that Docker for Windows only works correctly on Windows 10 Home. If you need to upgrade to Windows 10 Education, please let me know.

If your installation does not go smoothly or you have additional questions, please let me know.