Skip to content

Docker launch config not running after last update #20655

Closed
@michuhu

Description

@michuhu

This issue has been confired by multiple users on microsoft/vscode github. @roblourens told me to move the issue here.

  • VS Code Version: Version: 1.75.0
  • Python extension: v2023.2.0
  • OS Version: Mac OS Ventura 13.1 (22C65)

After Update of Python extension to v2023.2.0, when using configuration defined in launch.json with Docker - e.g. "name": "Docker: Python gunicorn", I get an popup error

Invalid message: "pythonPath" is not valid if "python" is specified

I cannot locate this error in any OUTPUT window.

I'm pretty sure, that everything worked before the update, because I committed those files to git yesterday. When this stopped working I checked them out to see if maybe I made a mistake somewhere, but no.

This doesn't happen when I run the .py file locally, nor when I build and run container manually.

I've downgraded to 1.74.3 and it's all fine.

Reinstallation of vscode and deleting .vscode folder doesn't help either.

launch.json

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Local Python: flask",
            "type": "python",
            "request": "launch",
            "module": "flask", 
            "env": {
                "FLASK_RUN_PORT": "8082"
            },
            "args": [
                "--app",
                "app:server",
                "--debug",
                "run"
            ],
            "justMyCode": true
        },
        {
            "name": "Docker: Python flask",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug flask",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/app"
                    }
                ],
                "projectType": "flask"
            }
        },
        {
            "name": "Docker: Python gunicorn",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug gunicorn",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/app"
                    }
                ],
                "projectType": "general"
            }
        }
    ]
}

tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "docker-build",
			"label": "docker-build",
			"platform": "python",
			"dockerBuild": {
				"tag": "tuzdashapp:latest",
				"dockerfile": "${workspaceFolder}/Dockerfile",
				"context": "${workspaceFolder}",
				"pull": true
			}
		},
		{
			"type": "docker-run",
			"label": "docker-run: debug flask",
			"dependsOn": [
				"docker-build"
			],
			"dockerRun": {
				"env": {
					"FLASK_APP": "app.py",
					"FLASK_DEBUG": "1"
				},
				"volumes": [
					{
					  "containerPath": "/app", "localPath": "${workspaceFolder}"
					}
				  ],
				"ports": [
					{ "hostPort": 8082, "containerPort": 8082 }
				  ]
			},
			"python": {
				"args": [
					"run",
					"--no-debugger",
					// "--no-reload",
					"--host", "0.0.0.0",
					"--port", "8082"
				],
				"module": "flask"
			}
		},
		{
			"type": "docker-run",
			"label": "docker-run: debug gunicorn",
			"dependsOn": [
				"docker-build"
			],
			"dockerRun": {
				"volumes": [
					{
					  "containerPath": "/app", "localPath": "${workspaceFolder}"
					}
				  ],
				  "ports": [
					{ "hostPort": 8082, "containerPort": 8082 }
				  ]
			},
			"python": {
				"args": [
					"--timeout", "240",
					"--reload",
					"--bind", "0.0.0.0:8082",
					"app:server"
				],
				"module": "gunicorn"
			}
		}
	]
}

Metadata

Metadata

Labels

area-debuggingbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous releaseverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions