Skip to content

Instantly share code, notes, and snippets.

@MaddyGuthridge
Last active September 8, 2022 05:04
Show Gist options
  • Save MaddyGuthridge/afde38340c6d13c17193273ffa471ed3 to your computer and use it in GitHub Desktop.
Save MaddyGuthridge/afde38340c6d13c17193273ffa471ed3 to your computer and use it in GitHub Desktop.
Setup instructions for using Docker in COMP6771 at UNSW

I've been informed that a new build system is in place for COMP6771 from 22T3 and onwards, so these instructions may not be accurate or up-to-date anymore.

1. Install Docker

Use this link.

If you're on Linux, you may need to install the engine separately to the desktop app. Have a look for your distro in the Server section of the page above and install that first.

2. Build the provided docker image, then start a container for it

Launch a terminal in a folder containing the course docker image, which you can download from the config/ci folder for each repository in the course.

# build the image, tagging it as cs6771
$ docker build -t cs6771 .

# Start the image, so that we can connect to it from VS Code
$ docker run -d -t cs6771:latest

3. In VS Code, install the 'Remote - Containers' extension

This lets VS Code connect to the docker container and run our code in it.

4. In the bottom left corner, click the remote (><) button, and choose to 'Attach to running container'

Choose the running container you started from the cs6771 image. VS Code will refresh.

5. Install all your desired extensions to the container

Because the container is essentially a virtual system, it has separate storage, and won't have most of your extensions installed yet. Here's what I recommend for this course:

  • A nice theme (such as SynthWave '84)
  • C/C++ Extension Pack (provides syntax highlighting and build tool integration)
  • C++ TestMate (allows you to run your tests easily within VS Code)
  • Clangd (integration with Clang to allow for better inline error messages)
  • CMake Language Support (if you ever need to edit your CMake build files)
  • CodeLLDB (improved support for debugging)
  • Native Debug (more debugging things - not sure if this is necessary tbh)
  • Code Spell Checker (bad spelling is a bad look tbh)

6. Git Clone your course projects

Because Docker environments are a separate system, you'll need to clone your code to within your container's file system. Your SSH keys should automatically be shared with your primary OS.

From the command palette, run "Git: Clone" (NOT "Remote-Containers: Clone Repository in Container Volume..."), and paste the URL for your project repository. The project will be cloned and you can choose to open it.

Credits

Adapted from Kuroson's guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment