Search code examples
vscode-remotevscode-devcontainer

devcontainer.json. Breakpoints not working


I launch a debug session through the Module option and specifying a folder, the app starts up and responds to requests - and code changes are seen when other services interact with mine by calling into it (print statements show the change in the terminal output of the IDE), however, breakpoints are not hit. How come?

My devcontainer.json file looks like this:

{
    "name": "Existing Dockerfile",
    "build": {
        "dockerfile": "../Dockerfile",
        "context": "../.",
        "target": "deploy"
    },
}

My Dockerfile does the usual stuff and runs our app with python -m app:

FROM python:3.9.3-slim AS deploy
COPIES SOME FILES
CMD ["python", "-m", "app"]

Solution

  • My problem was the version of python that was pulled in.

    In my Dockerfile, I had to change:

    FROM python:3.9.3-slim AS base
    

    to

    FROM python:3.9.4-slim AS base
    

    Then breakpoints started working.