Home > Back-end >  VSCode - Dev container on docker not running
VSCode - Dev container on docker not running

Time:08-01

I've been using the "Remote - Containers" extension to run python inside a docker container. This has been working great for me for the last couple of month without any issues.

Today I've tried doing the same on a repo I haven't ran before. Went through the entire process and I'm connected to the docker container as usual. I can run things in the terminal, and I can verify that everything I need installed is indeed installed.

The issue is - when I try to debug my code (by pressing F5, or even without debugging using ctrl F5) nothing happens. I can see the small play pause stop bar popping up - enter image description here but it immediately closes and nothing runs...

When I look at the output of the python extension, I can see the line DAP Server launched with command: /usr/bin/python3 /root/.vscode-server/extensions/ms-python.python-2022.10.1/pythonFiles/lib/python/debugpy/adapter but again, nothing runs after that...

My launch.json looks like this -

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        },
    ]
}

and I'm running a simple python file -

a = 1
print(1)

with a breakpoint on each line which never triggers

This is really weird, as mentioned, I've been working this way for a long time and everything worked great up untill now...

CodePudding user response:

  1. Make the following changes in launch.json:

"justMyCode": true

change true to false.

  1. Use the debugging options in the red box:

enter image description here

  1. If the above does not take effect, please add the following content to launch.json:

    "debugStdLib":true,

CodePudding user response:

The issue was the python version I've had installed inside the docker and the version of the python extension. I had python 3.6.9 on python extension v2022.10.1 which is incompatible.

The solution was to downgrade the python extension to version v2022.8.1 by adding the following to devcontainer.json -

    "settings": {
        "extensions.autoUpdate": false,
        "extensions.autoCheckUpdates": false
    },
    "extensions": [
        "[email protected]",
    ]
  • Related