![]() ![]() When your project is ready, you can stop the container using: docker stop gdb-cpp-imageĪnd if you need it again, just type: docker start gdb-cpp-image Conclusions The provided launch.json is configured to break on entry ( "stopAtEntry": true,) so you can immediately see that it is working. Hit F5 to start debugging in the container. Replace the content of the tasks.json with the following code: with the correct path. If you have already a running project, you can create this file by yourself. Therefore, to configure/create it in a new project, press Ctrl Shift B and follow the prompts until you get to "Others" (see Fig. The task is usually defined in a tasks.json file inside the. Building C in a container with VS Codeįirst, let’s configure a building task. Visual studio code ubuntu debug full#Therefore, you need to be inside the source code folder while you run this command, or you can change the $PWD value with a full path to the source directory. The -v parameter creates a bind mount that maps the local file system ( $PWD - print working directory) into the container ( /source). As debugging requires running privileged operations, you'll run the container in unconfined mode, thus the -security-opt set to seccomp:unconfined. ![]() The -p parameter links the port 2222 to the exposed 22 port of the container. The -d parameter detaches the Docker container from the terminal. To run a container based on this image so that VS Code can debug processes in it, type the following on a terminal inside the folder, in which your source code is located: docker run -d -p 2222:22 -security-opt seccomp:unconfined -v $PWD:/source -name gdb-cpp-image gdb-cpp-image The image will be built with a name gdb-cpp-image. To build this image, type the following on a terminal inside the folder, in which you created the Dockerfile file: docker build -t gdb-cpp-image. Visual studio code ubuntu debug install#The following lines install and enable SSH with user and password root:root and expose the port 22. The second one includes the libraries required for my C application. The first one is required to remotely build and debug applications. In this case, for example, you see that I included two apt-get install -y lines. You should consider that this Docker image should have all libraries that you need to compile your application. I like to use Debian images because of Debian simplicity.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |