VScode with Docker | CS 2113 Software Engineering - Fall 2021

Running VSCode with a Docker Container for C

Did something go wrong? Check out the troubleshoot guide

  1. Install Docker Desktop https://www.docker.com/products/docker-desktop

    Note that if you are using windows you will also need to install WSL2. Microsoft has a great guide for that. Do this first before install Docker Desktop.

  2. Run Docker Desktop. Docker desktop must be running to open a VS Code folder in a Docker container.
    Docker Icon Image

  3. Install Visual Studio Code (VS Code)
    https://code.visualstudio.com/download

  4. Install the Remote Development extension pack plugin for VS Code
    Visual Studio Image

  5. Open a folder in a docker container (Reference: https://code.visualstudio.com/docs/remote/containers)
    – Open the command pallet with the F1 key
    – Type “Remote” to get a list of remote containers commands
    – Select “Remote-Containers: Open Folder in Container”
    VS Code Open Folder In Container Image

  6. Create a new folder, or open an existing folder.

  7. When prompted to “Add Development Container Configuration Files”, select “Develop C++ applications on Linux.” and “ubuntu-20.04”
    VS Code Add Development Container Configuration Image
    VS Code Add Development Container Configuration Linux Image

  8. It may take and few minutes for the container to be created and initialized.

  9. Create a new file called helloworld.c and populate the file with the hello world code from C0-C-basics
    VS Code Hello World Image

  10. Open a new terminal.
    VS Code New Terminal Image

  11. In the terminal window use gcc to compile and run helloworld.c.
    VS Code GCC Image