title: VSCode Debugging in Docker: Unable to resolve non-existing file
body: <p>I am programming in c++ using docker. Recently I tried to set up my GDB debugger in VSCode to help with some issues I was having and it turns out that was a bigger pain to do than I thought. I've gotten close but I keep getting the error <code>Error: Unable to resolve non-existing file '/mnt/files/p5-student/src/main.cpp'</code>. I'm not sure why this is happening.</p>
  
  <p>I followed <em>most</em> of the instructions from <a href="https://stackoverflow.com/questions/51433937/how-to-compile-debug-a-c-application-in-docker-with-visual-studio-code-on-wind">this</a> post, but I skipped a decent amount of steps because I don't want to create a new docker image, I just want to use one provided by my professor.</p>
  
  <p>This is my <strong>launch.json</strong>:</p>
  
  <pre><code>{
      "version": "0.2.0",
      "configurations": [{
          "name": "(gdb) Pipe Launch",
          "type": "cppdbg",
          "request": "launch",
          "program": "/mnt/files/p5-student/main",
          "cwd": "/mnt/files/p5-student",
          "args": [],
          "stopAtEntry": true,
          "environment": [],
          "externalConsole": true,
          "pipeTransport": {
              "debuggerPath": "/usr/bin/gdb",
              "pipeProgram": "docker",
              "pipeArgs": ["exec", "-i", "os_container", "sh", "-c"],
              "pipeCwd": "${workspaceRoot}"
          },
          "MIMode": "gdb",
          "setupCommands": [{
              "description": "Enable pretty-printing for gdb",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
          }]
      }, ]
  }
  </code></pre>
  
  <p>My code is stored in my docker container in <code>/mnt/files/p5-student</code> and our MakeFile creates an executable called <code>main</code></p>
  
  <p>This is <strong>tasks.json</strong></p>
  
  <pre><code>{
      "version": "2.0.0",
      "tasks": [
          {
              "label": "prepare to debug",
              "type": "shell",
              "command": "docker start -i os_container",
              "group": "build",
              "problemMatcher": []
          }
      ]
  }
  </code></pre>
  
  <p>I have an already created docker container, so I just want to start it with this task.</p>
  
  <p>When I run the debugger I get the first local variable from <code>main.cpp</code>, but then VSCode hits me with <code>Error: Unable to resolve non-existing file '/mnt/files/p5-student/src/main.cpp'</code></p>