Resources

Quick Reference

Once you have understood the text below about our Docker container, you may want these commands:

  • Create the Docker container locally (done once):
    docker create -it --name cmpt201 ghcr.io/sfu-cmpt-201/base
  • Run the Docker container (done each time):
    docker start -ai cmpt201
  • Connect to an already running Docker container:
    docker exec -it cmpt201 zsh --login
  • Troubleshooting
    1. Is Docker running?
      Try running Docker Desktop and ensuring that it starts up correctly. You may see an error that looks like: error during connect: this error may indicate that the docker daemon is not running: Head "http://%2F%2F.%2Fpipe%2Fdocker_engine/_ping": open //./pipe/docker_engine: The system cannot find the file specified.

Docker Container Setup

  • You will use a Docker container for everything in this course.
  • You are not allowed to modify this setup in any way. Doing so is considered an academic integrity violation.
  • Setting up the Docker container will take some time, e.g., a few hours, and it is necessary for the first assignment, which will take another few hours. So make sure you start this right away. Downloading and running the container (as described below) is not the end of the setup process. There are more things to do after you log in.
  • First, install Docker Desktop. Choose the correct version for your platform. If you already have Docker installed, make sure you have the latest version. Once you install it, start it. You can run it in the background as you don't need the GUI.
    • On Linux, it may be simpler to just install Docker Engine instead of Docker Desktop. It is lighter weight than Docker Desktop. If you decide to do it, after installation, you should also follow the instructions on Manage Docker as a non-root user. This way, you can avoid using sudo to use Docker.
  • Next, make sure you have a good terminal emulator installed. For Windows, install Windows Terminal. For Mac, install iTerm2. Do not use the default Terminal app since it's not going to display certain things correctly. For Linux, the default terminal is fine at least for GNOME. We have not tested the default terminal for KDE. There are many other options such as foot, Alacritty, etc., but you need to be comfortable with editing configuration files with these. You can use those if you know what you're doing or if you are more adventurous.
  • You will spend a lot of time on the terminal in this course. Therefore, it is important to use a terminal setting that is comfortable. Change the terminal setting as follows.
    • Change the width to more than 100, e.g., 110.
    • Change the height to a length that is sufficiently long.
    • Change the color scheme to solarized dark. Windows Terminal, iTerm2, and GNOME Terminal should support it out of the box. Google how to change the color scheme if you are not sure. For other terminal emulators, it's likely that you need to install the theme separately.
  • Open the terminal and enter the following commands.
    • docker create -it --name cmpt201 ghcr.io/sfu-cmpt-201/base
      • This command downloads our container image (ghcr.io/sfu-cmpt-201/base) and creates an interactive (-it) container named cmpt201.
      • Note that you only need to execute this once as you don't need to create an image multiple times.
    • docker start -ai cmpt201
      • This command starts the container interactively (-ai) and lets you enter the container.
    • Once again, from now on, you do not need to create a container image. You only need to start the created container. In other words, you only need to execute docker start -ai cmpt201.
  • At this point, you should see a greeting message and a command-line prompt (~❯).
  • If you enter ls, you should see two files (start_here.sh and units).
  • Enter ./start_here.sh and read through. It will show you what to do.
  • When you want to stop using the container, enter exit.
  • When you want to use the container again, enter the start command (docker start -ai cmpt201).
  • Make sure you do not delete the container (e.g., docker rm). You will lose all the files, i.e., your work.

Resources