Python project using docker as SDK.

Answered

I have a Python project using Docker as interpreter in IDEA Ultimate.

1) It starts a few containers when run and debug code. The containers are still there running even I quit IDEA completely. Is this normal? I'd like to clean up these containers after IDEA exits and confirmed to exit background tasks. showing as below.

 docker container ls
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                      NAMES
121ab689bbd1   abb467749c26   "python -u /opt/.pyc…"   23 seconds ago   Up 22 seconds   0.0.0.0:57151->57151/tcp   interesting_driscoll
30b366f1bd75   abb467749c26   "python -u /opt/.pyc…"   3 hours ago      Up 3 hours                                 busy_matsumoto
69a1f37261cf   abb467749c26   "python -u /opt/.pyc…"   9 hours ago      Up 9 hours                                 clever_jang
f4311daeda40   abb467749c26   "python -u /opt/.pyc…"   11 hours ago     Up 11 hours                                suspicious_buck

 

2) The Python code seems run a lot slower than using venv, is there any setting to speed it up?

3) Analysis seems off sometime, for example, even I forget import a library and start using it, the IDEA doesn't show any error/warning.

4) Sometimes the bottom of the IDEA shows "Launching skeleton generator..." for long time. Restart IDEA usually fixes it.

Thanks!

0
3 comments

1) It's not entirely up to IDEA to stop those containers, it should be done by Docker if you specify the correct docker compose options.
Try adding up --abort-on-container-exit <service_name> to the Command and options field of your run configuration. Has it helped?

2) Is it slower in IDEA than when you run it in the command line using the same docker interpreter?

3) Does it happen randomly? Does invoking Rescan Available Python Modules and Packages from Search Everywhere (double-Shift) help?

4) It's probably this known issue https://youtrack.jetbrains.com/issue/PY-55096/PyCharm-stuck-at-Launching-Skeleton-Generator-with-Docker-Desktop-410-or-newer
You can try the EAP build https://www.jetbrains.com/idea/nextversion/ or downgrade your Docker Desktop to 4.9.1

0

1) 3) 4) all gone once I downgrade docker desktop to 4.9.1

 

2). It seems much slower than not using docker as interpret.

 

thanks

 

0

>It seems much slower than not using docker as interpret.

I'd say it's expected unless it's significantly faster in the command line than in IDE.

0

Please sign in to leave a comment.