-
Notifications
You must be signed in to change notification settings - Fork 520
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Flask project debug in docker container doesn't start #2716
Comments
I tried it out with mostly the same stuff you have (albeit once on Windows and once in Linux Codespaces) and was successful. Is there a Python interpreter selected in the lower left? Is there any difference in the output if you do:
vs.
Compose debugging is an alternative but I'm not sure if hot reloading will work. In the {
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
]
} |
Thanks! Do you mean the python version on the host machine?
That's an anaconda installation. Once I press F5 it also shows this python version Interestingly I also got the option to pick this "geoserver conda" version (geoserver is my project) and no idea where that comes from: EDIT: OK the following happened because I added a workspace OK found this #2327 - removed the workspace again (created it today because I wanted to ship the final thing to the client as a workspace, but fine without it as well). |
@int19h I forgot how to turn on the extra diagnostics so we could see what's happening with Python debug--can you remind us? |
So as I see it, it doesn't run my task at all. At least it outputs it nowhere.
Output etc. all empty. EDIT: Also interesting: when I go to the docker tab and right-click the container and try "show logs" or "attach shell" it prints the command in the terminal but never get a response Inspect works and opens a new file with the results. Running docker logs from my regular linux terminal shows me that the "dummy" interpreter is running:
|
Yeah, I've seen that behavior--where the |
TODO: @bwateratmsft Will make a small prototype of a flask app that does not emit an output to find a debugging issue. |
Quick info from my side: meanwhile setup up Windows with WSL2 based docker and it worked without any issues or modifications. |
We just released extension version 1.10.0, which included some changes in this space to make WSL debugging work better. Are you on 1.10.0 now (for that attempt on Windows where it worked)? Can you try again on Linux with 1.10.0 and see if there's any change? |
Windows is running 1.10.0, although I'm not fully sure if it did an auto-update since I tested it a few days ago. |
Hey @m-toman, sorry for the slow response, we've been super busy lately. We met with the Python debugger folks and they had a few things to try out. Meanwhile, they've opened microsoft/debugpy#579.
|
Thanks, good timing as I am likely back working on the service next week. |
OK I quickly tried it, @bwateratmsft debugger.vscode_9e59d0c5-6125-4204-a225-7e99e0a97300.log |
@int19h Nothing sticks out to me in those logs; there isn't any error similar to what we tried yesterday. Any ideas? |
I'm going to convert this to a discussion. As far as we can tell there's not a bug in the Docker extension; andhttps://github.com/microsoft/debugpy/issues/579 has been opened in debugpy. I'd still like to get to the bottom of what's happening, though. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
/Hi,
I've encountered the same issue as in #2313 and was not able to resolve it yet.
I am also on Linux but running a Flask app in a docker container.
Followed along https://code.visualstudio.com/docs/containers/debug-python#_for-flask-apps and ended up with:
launch.json
tasks.json
When I run the container with F5 it just seems it just runs the "dummy" python interpreter but not actually the flask app.
If I exec -it /bin/bash into the container and run "python -m flask run --host 0.0.0.0 --port 8090" I can connect to the service and it works fine (of course without debugging).
Outputs:
Output: empty
Debug console: empty
Terminal 1: empty
Terminal 2:
Terminal 3 (Python Debug Console): empty
At first I did not use docker-compose, after reading a few issues here I added the files as following and performed "compose up" on docker-compose.debug and then F5, but same result:
Do I need docker compose?
If I run "compose up" it just gives me
Pushing the restart button gives me "There is already a debug configuration "Docker: Python - Flask" running.
Pushing stop seems to stop whatever it is doing in VS code but the docker container is still running (probably supposedly so?)
docker inspect bridge --format="{{(index .IPAM.Config 0).Gateway}}"
gives me
172.17.0.1
And docker inspect:
Thanks!
EDIT: Dev.Dockerfile:
EDIT2:
ping 172.17.0.1 and ping 172.17.0.2 works.
The text was updated successfully, but these errors were encountered: