Docker Setup

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. A Docker container is a virtual environment that you can enable and treat like a computer within your computer: it will contain all of code and libraries that you need for the semester. The container will be hosted on Docker cloud, so if I update the container (for instance, to update a package version to work with a lab), 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.

  • Top-level folder to hold my repos: /home/xanda/Documents/nlp/

To run docker, use the following command (as a single line):

docker run -it -h docker -v /home/xanda/Documents/nlp:/home/student/nlp harveymudd/cs159-student:fall2020 bash


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

  • Top-level folder to hold my repos: C:\Users\Xanda\My Documents\nlp

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 (as a single line):

docker run -it -h docker -v C:/Users/Xanda/Documents/nlp:/home/student/nlp harveymudd/cs159-student:fall2020 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. Both of these also have extensions to support remote pair programming (like Teletype for atom or Visual Studio Live Share for VS Code). However, you're also welcome to just screen share for pair programming in group work, as long as you're good about switching regularly who is typing.

Note that Docker for Windows can be tricky to set up: until recently, it only supported Windows 10 Home, and it's not clear to me yet if it will work otherwise. You can try out the regular Windows instructions here, or try setting it up with the Windows Subsystem for Linux 2 (WSL 2) . (Note that updating from WSL 1 to WSL 2 may delete all your Linux-bound files, so back things up!) I currently have this working with Ubuntu for Windows on Windows Enterprise and can try to help debug. If you'd like to avoid the headache, just use your CS login to the knuth server and work on things there.

If your installation does not go smoothly or you have additional questions, please let Prof. Xanda or a grutor know on Slack.

Pandoc Troubleshooting

For most labs, we encourage you to use a Markdown file to make your writeup, compiled using a LaTeX-aided pandoc instance. If you don't have things set up on your computer to do this, fear not: Docker has your back.

  1. Using Docker, pull down an image containing pandoc and LaTeX: docker pull pandoc/latex:latest

  2. Navigate to the directory where your .md file is (let's say analysis.md)

  3. Use the following Docker command to run pandoc on the file and save the output as a PDF:
    docker run --rm -v "`pwd`":/data pandoc/latex:latest analysis.md -o analysis.pdf