Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Codespaces] Python Debugging for single Dockerfiles does not work in VS Codespaces #2565

Closed
ucheNkadiCode opened this issue Dec 11, 2020 · 7 comments

Comments

@ucheNkadiCode
Copy link
Contributor

After creating a working repo for a Python application in VS Codespaces.

When you run the command Docker: Add files to workspace, I selecting Python: Django with all of the defaults. This created a launch configuration named Docker: Python - Django. Unfortunately, upon F5 there seemed to be some sort of failure in Volume Mapping the debugger. Maybe there is an issue with the scaffolding of the launch configuration.

Workaround: In order to debug I had to create a Python: Remote Attach configuration in launch.json. I then ran the command Docker: Add Compose Files, ran compose up on a container, then attached to to the running container.

I would like to be able to debug my Python application in a container with only a Dockerfile.

@karolz-ms
Copy link
Contributor

Thanks @ucheNkadiCode! Let's explore if we can avoid the volume mapping for Python by installing the debugger directly into the container.

@bwateratmsft feel free to steal this from me if necessary

@bwateratmsft
Copy link
Contributor

bwateratmsft commented Dec 14, 2020

We can, but it carries the risk of incompatibilities with the Python extension. Since we need volume mappings for .NET debugging to work, IMO it's simpler if we just require the same for Python.

@bwateratmsft
Copy link
Contributor

Additionally: either it would have to be in the Dockerfile (not pretty), or it would have to be done on the running container, which would add a small amount of time to the inner loop. Not a lot, debugpy is small, but some.

@bwateratmsft
Copy link
Contributor

This is also covered by #2389, but I'll leave this issue open; we plan to copy in debugpy in the short term so we'll use this to track that.

@dbreshears dbreshears added this to the 1.10.0 milestone Dec 15, 2020
@dbreshears dbreshears added the P1 label Dec 15, 2020
@bwateratmsft
Copy link
Contributor

We talked about this yesterday in a meeting, but we realized that volume mapping is probably not the only problem for Python. The debugging flow involves starting a debugpy server on the host machine, and starting a debugpy client within the container. That client is given information on how to connect back to the server. Generally this is done through the host gateway (Linux), or just simply 'localhost' (Mac, Win), but I doubt this will work in Codespaces' Docker-beside-Docker scenario.

@bwateratmsft bwateratmsft changed the title Python Debugging for single Dockerfiles does not work in VS Codespaces [Codespaces] Python Debugging for single Dockerfiles does not work in VS Codespaces Jan 7, 2021
@bwateratmsft
Copy link
Contributor

I'm going to move this to 1.10.0, with the ongoing work to set up Codespaces for Docker-in-Docker now is not a good time to try to make big changes.

@bwateratmsft bwateratmsft modified the milestones: 1.9.1, 1.10.0 Jan 8, 2021
@bwateratmsft
Copy link
Contributor

This works now with Codespaces' Docker-in-Docker setup! No work needed from us.

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants