Installation of Docker, VSCode and its extensions - SVF-tools/Teaching-Software-Verification GitHub Wiki
0. Prerequisite:
- Install Docker
- To know more about Docker - 12 mins video to understand Docker:YouTube Bilibili
- If you have installation problems on Windows. Please refer to windows-docker-problem-solutions
- Install VSCode
- For further using and learning VSCode - Learn to code with VSCode
- If you are using M1-chip machine and need debug/step-in your machine, please refer to GCP and M1-build then follow this wiki later.
1. Working with VSCode in Docker containers
1.1 Install extensions in VSCode
*To install the extension, open the Extensions view (MAC: ⇧⌘X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)
- Extension(1): Docker extension
- Search for
docker
to filter results and select Docker extension authored by Microsoft.
- Search for
- Extension(2): Dev Containers extension
- Search for
dev containers
to filter results and select extension authored by Microsoft.
- Search for
1.2 Pull the pre-built image in Docker hub
Step1: Enter the command in cmd or terminal (shortcut to open a terminal: Ctrl+`):
Please check your machine's architecture and run one of the following commands to pull the image from Docker Hub:
-
for x86_64: (x86 Windows Docker, Mac Intel, Linux x86_64)
docker pull svftools/teaching-software-verification:latest
-
for arm64: (Mac M1, Linux arm64)
docker pull svftools/teaching-software-verification:latest-arm64
Step2: Create and run a container of the image:
According to your machine's architecture, run one of the following commands to create and run a container of the image:
-
x86_64:
docker run -itd svftools/teaching-software-verification:latest /bin/bash
-
Arm64:
docker run -itd svftools/teaching-software-verification:latest-arm64 /bin/bash
Build docker image of the Teaching-Software-Verification project using Dockerfile
For further reading and using Docker:1.3 Load Docker container in VSCode
Right click the container item and select 'Attach to Visual Studio Code'
file -> open (folder)...
then enter the /home/SVF-tools/Teaching-Software-Verification
If you can't see the working directory, please select 1.4 Install/Enable C/C++ extension in container
- To install the extension, open the Extensions view (MAC: ⇧⌘X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)
C/C++
and select Docker extension authored by Microsoft.
- Search for 1.5 Install/Enable Python extension in container
- To install the extension, open the Extensions view (MAC: ⇧⌘X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)
Python
and select Docker extension authored by Microsoft.
- Search for 2. Run and debug your program (C++)
- VSCode's built-in debugger helps your editing, compilation and debugging.
- SVF-Teaching has prepared configurations in
launch.json
to debug hello.cpp - Select
(gdb) Launch C++
- Take a look at this page which contains several troubleshooting when configuring VSCode debugging environment.
- More information VSCode-debugging
2.1 Switching programs
When working on different assignments, change the "program"
field in launch.json
(line 8). Values can be assign-1
for Assignment 1, assign-2
for Assignment 2, assign-3
for Assignment 3, assign-4
for Assignment 4, hello
for the hello world program, and codegraph
for the code graph project.
3. Run and debug your program (Python)
- Select
Launch Python Script
- Check the
launch.json
file in the.vscode
folder to see the configurations.
{
"name": "Launch Python Script",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/python/Assignment-1/Assignment-1.py", # Script Path
"console": "integratedTerminal",
"cwd": "${workspaceFolder}", # working directory
"args": [] # arguments
}
3.1 Switching programs
When working on different assignments, change the "program"
field in launch.json
and check the python
folder to
see the script. Values can be ${workspaceFolder}/python/Assignment-1/Assignment-1.py
for Assignment 1, or other scripts in the python
folder.