Container Setup

There are two ways for you to get the appropriate environment for use in this class

  1. Remote access to an OIT provided container. Recommended method for use in class.

  2. Local container on your machine if you have an Intel x86_64 processor, not an Apple M1 processor. This is for the more advanced users, the OIT containers are just easier to use.

See the appropriate section below for setup instructions.

Remote OIT Container (Recommended)

You can use the oit container manager at https://cmgr.oit.duke.edu/ and reserve a cs210 container. After reserving your container you should see a page with an area for container controls like that shown below.

The important information is in the bold line after the "You can also access..." You will be using ssh from a local terminal and within VSCode to access the container. As you learned from the Linux/bash tutorial, ssh is a command you type into a terminal on your local machine to connect to a remote host. In the example above the command allows connecting as user term to the container cs-az-00.oit.duke.edu (I've omitted the password) that will be displayed below the ssh command. The -p option to ssh indicates a specific port to use when accessing the container, you must always use this option.

To access your container open a terminal on your local machine and type the ssh command shown on your container reservation page and when prompted enter the indicated password (you should be able to copy paste the password).

As part of the Linux tutorial you created an ssh key on your local machine, you should copy the public key to your container as described for MAC and Windows.

Data on the OIT containers is not backed up! It is critical that you back up your work by pushing to git frequently.

Local Container

If you have an Intel x86_64 processor you can run a container locally and not use the OIT remote container. The following outlines the steps:

  1. Install docker on your local machine (laptop or desktop). Download docker desktop for your machine.

  2. Create a directory/folder on your local machine for Compsci 210.

  3. Download this Docker file and place it into your just created 210 directory.

  4. Change directory into your 210 directory.

  5. Type the command docker build -t dev210 . to create a container image (Note the . after the dev210 that indicates the current directory).

  6. Start the container with an interactive bash shell using
    docker run --name cs210 --mount type=bind,source=<local container directory>,destination=/cs210 -it dev210 bash where <local container directory > is the directory you created above. For example I use ~/Containers/210 for my directory and thus run the following command.
    docker run --name cs210 --mount type=bind,source=/Users/alvy/Containers/210,destination=/cs210 -it dev210 bash to start the container and start an interactive bash shell (Dockerfile should be in the directory specified by the source argument).

In the container terminal/shell you will notice the directory /cs210 and if you list that directory it contains the same files as your local machine 210 directory. Try it by creating a file in that directory on your host machine and will be visible on your container. This will be useful when we get to git and programming since you will run git in a local terminal but do programming compiling in the container.

We will have to do something a little different for one project later in the semester. We will provide instructions on that later.