Debugging Python in Docker using VSCode

preview_player
Показать описание

Good day folks! In this video we'll take a look at debugging python code inside docker containers using VSCode remote debugging!

Like and Subscribe!
Also if you want to support the channel further, become a member 😎

Checkout "That DevOps Community" too

Source code:

Follow me on socials

Music:
Track: Grouf - PIPED UP /w Lord Sesshomaru

Track: Lucid Monday - Soudiere - Hollow Tips

Рекомендации по теме
Комментарии
Автор

The most DevOps guy I've ever seen, not even python installed locally :D

aike.h.
Автор

taking debugging to a whole new level.. THANKS!

khaledarja
Автор

Finally! I am debugging Python in Docker! You're awesome! Thank you :)

guillermomoran-arreola
Автор

Excellent content as always and very useful! P.S. If you are running VSCode inside the container (rather than on your local machine) via the VSCode Remote Extension, the debugging setup is a little different. There is no "portMapping" section needed from your localhost to the remote host. They've also upgraded PTVSD to DebugPy since. Keep making great stuff!

johnkntran
Автор

Great! Can you do a video on debugging a Kubernetes python application ?

grcdeepak
Автор

Great, this finally works. I tried so many things to debug into a flask docker environment. I tried ptvsd before without luck, i tried remote containers, etc.

mikevictorecho
Автор

Clear concise and well explained. Thank you

tonyBeloni
Автор

Thanks for the real example, actually there is one thing to update to make it running, in the requirements.txt, using Flask == 2.0.3 instead.

pingyang
Автор

I'm not 100% sure because I tried a little to make it work, but here's what I had to change in the Dockerfile to replace ptvsd with debugpy:

1. RUN pip install debugpy

2. CMD python -m debugpy --listen 0.0.0.0:5678 --wait-for-client -m flask run -h 0.0.0 -p 5000

Автор

Appreciate your work. Really relevant to my current work. Thank you

marekczarnecki
Автор

my question is how can I connect to container which is already running ? It seems like vs code starting new container in debug mode instead of connecting with existing one

treerhym
Автор

Thanks - that's awesome !
It's important to note the ptvsd is deprecated in favor of debugpy :)

Slygon
Автор

@That DevOps Guy can we debug aws lambda (python) created using container image with the same approach? We can do with AWS SAM template but wondering can we directly debug the Lambda Container using the same approach?

raavimanoj
Автор

Thank you for the video, I did the same configs but for a file not a server, it runs the debugger but I can't see anything in the variables and watch, and it also not stoping on a breakpoint

ALaaHamoudah
Автор

AMAZING video! thank you so, so much!

mciccozz
Автор

Huge thanks! I could setup here in a container with a complete diferent scenario. It's a Video traffic recognition using CUDA/GPU
Again, Huge Thanks!

nailsonlandim
Автор

how do you get this to work for a pyramid application that serves using 'pserve'? any help or direction would be appreciated!

bzouchir
Автор

Awesome video! Question: if I do not use the "wait", can I still attach the debugger to the container?

AlexandreShimono
Автор

This is very useful. but just wonder if any code change on your local src will be reflected and live loaded into your running docker?

ruiw
Автор

Hi Marcel, fantastic video! I have this setup with my project but I cannot get it to hit any of the breakpoints I have defined.

jayhawkelectrical