Setup Xdebug configuration for php scripts called in cron by docker-entrypoint.sh in vscode

Currently using VSCode on MacOS, Xdebug is working well for my php web application ran with docker.

But I also have some php scripts that are called by the docker-entrypoint.sh as crons and I’d like to be able to debug them as well. I can’t configure it properly, nothing happens when I set breakpoints while the crons are running.

Here is my launch.json configuration at the moment (all the codesource – web, scripts…- is under myapp/app) :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9001,
            "log": true,
            "pathMappings": {
                "/opt/myapp/app": "/Users/me/src/myapp/app"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9002,
            "log": true
        }
    ]
}

In my docker-compose.yml, I also have PHP_XDEBUG_ENABLED=true for the web container and the cron container of course.

Any ideas / configuration examples to get the debug working for the php crons ?