Docker as Remote Interpreter Not Reaching start Container step
Hi, I am trying to use Docker as a Remote Interpreter as per the instructions at https://www.jetbrains.com/help/pycharm/docker-using-docker-as-a-remote-interpreter.html. I am running PyCharm 2017.3.3 (Professional Edition), build #PY-173.4301.16 on Windows 10 Enterprise and Docker 17.12.0-ce-win47 (15139) on the same host in an Enterprise environment.
Two issues observable from PyCharm is that
a. The packages do not load in the "Settings: Project Interpreter" window
b. The images do not load in the "Configure Remote Python Interpreter" dialogue box when you select the "Docker" radio button
(In fact any aspect of the Docker integration fails to work but these are two observable issues.)
It seems that the PyCharm Docker integration for the above issues requires a sequence of requests to the Docker daemon (which I'll enumerate below) but ultimately the request to start the container is not being sent.
Below I list the request sequence that I have observed and how I have validated them. I have installed wireshark to monitor the requests sent to the Docker daemon and have enabled debug mode for the daemon by using the Docker settings window, "Daemon" tab.
Step 1 - PyCharm requests a list of all containers.
I can see this request being sent and the response received on Wireshark:
18 0.048079 127.0.0.1 127.0.0.1 HTTP 342 GET /v1.24/containers/json?all=true HTTP/1.1
26 0.050888 127.0.0.1 127.0.0.1 HTTP 94 HTTP/1.1 200 OK (application/json)
I can see this request being received and responded to by the Daemon
[12:57:01.934][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="proxy >> GET /v1.24/containers/json?all=true\n"
[12:57:01.934][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="Dial Hyper-V socket <hyper_v_socket_details_here>"
[12:57:01.937][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="Successfully dialed Hyper-V socket <hyper_v_socket_details_here>"
[12:57:01.938][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="proxy << GET /v1.24/containers/json?all=true\n"
Step 2 - PyCharm requests creation of the container for getting the required info (e.g. for getting the packages)
I can see that the container gets created using "docker ps -a"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b6c7a639b54971989e98a905c3459ea9b8a8d1b5b8146e42539bf4b93d0b3283 python:3 "python /opt/.pycharm_helpers/packaging_tool.py list" 12 minutes ago Created cranky_leavitt
I can see the corresponding request sent and the response received on Wireshark:
56 0.275495 127.0.0.1 127.0.0.1 HTTP 856 POST /v1.24/containers/create HTTP/1.1 (application/json)
[with cmd like python /opt/.pycharm_helpers/packaging_tool.py list]
60 0.400650 127.0.0.1 127.0.0.1 HTTP 264 HTTP/1.1 201 Created (application/json)
I can see this request being received and responded to by the Daemon
[12:57:01.975][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="proxy >> POST /v1.24/containers/create\n"
[12:57:01.975][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="Dial Hyper-V socket <hyper_v_socket_details_here>"
[12:57:01.975][ApiProxy ][Info ] time="2018-02-24T12:57:01Z" msg="Successfully dialed Hyper-V socket <hyper_v_socker_details_here>"
[12:57:02.087][ApiProxy ][Info ] time="2018-02-24T12:57:02Z" msg="proxy << POST /v1.24/containers/create\n"
Step 3 - PyCharm sends a "attach to the just created container" request to the Docker daemon
I can see the corresponding request sent on Wireshark
86 0.550796 127.0.0.1 127.0.0.1 HTTP 562 POST /v1.24/containers/<container_hash>/attach?stdin=true&stdout=true&stderr=true&stream=true HTTP/1.1
Step 4- PyCharm _should_ send a start request to the container.
I don't see this request being sent on Wireshark.
I don't see any request being received by the Daemon.
I can find following error messages in the idea.log if I set the info level to DEBUG:
idea.log.8-2018-02-24 14:46:38,312 [ 252500] DEBUG - packaging.PyPackageManagerImpl - Collecting installed packages for the SDK Remote Python 3.6.4 Docker (python:3)
idea.log.8-java.lang.Throwable
idea.log.8- at com.jetbrains.python.packaging.PyPackageManagerImpl.collectPackages(PyPackageManagerImpl.java:264)
idea.log.8: at com.jetbrains.python.packaging.PyPackageManagerImpl.refreshAndGetPackages(PyPackageManagerImpl.java:369)
idea.log.8- at com.jetbrains.python.packaging.PyPackageManagerImpl.b(PyPackageManagerImpl.java:110)
idea.log.8- at com.jetbrains.python.packaging.PyPackageManagerImpl.hasManagement(PyPackageManagerImpl.java:105)
idea.log.8- at com.jetbrains.python.packaging.ui.PyInstalledPackagesPanel.a(PyInstalledPackagesPanel.java:99)
idea.log.8- at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
idea.log.8- at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
idea.log.8- at java.util.concurrent.FutureTask.run(FutureTask.java:266)
idea.log.8- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
idea.log.8- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
idea.log.8- at java.lang.Thread.run(Thread.java:745)
idea.log.8-2018-02-24 14:46:38,313 [ 252501] DEBUG - packaging.PyPackageManagerImpl - Collecting installed packages for the SDK Remote Python 3.6.4 Docker (python:3)
idea.log.8-java.lang.Throwable
idea.log.8- at com.jetbrains.python.packaging.PyPackageManagerImpl.collectPackages(PyPackageManagerImpl.java:264)
idea.log.8: at com.jetbrains.python.packaging.PyPackageManagerImpl.refreshAndGetPackages(PyPackageManagerImpl.java:369)
idea.log.8- at com.jetbrains.python.packaging.ui.PyPackageManagementService.getInstalledPackages(PyPackageManagementService.java:161)
idea.log.8- at com.intellij.webcore.packaging.InstalledPackagesPanel$11.run(InstalledPackagesPanel.java:415)
idea.log.8- at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:713)
idea.log.8- at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
idea.log.8- at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:543)
idea.log.8- at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
idea.log.8- at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
idea.log.8- at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
idea.log.8- at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
idea.log.8- at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
I can see this Step 4 occurring on an alternative Windows 10 Pro install running in my home environment so I know that PyCharm using Docker as a remote interpreter will function correctly in a different environment, and I am trying to debug precisely what is going wrong in the enterprise environment.
Please let me know if I can provide any further issues to help debug this problem.
Please sign in to leave a comment.
Hello,
Could you notice any difference in environment on these two machines? Do you use any antivirus software or firewall/proxy? Is it possible to share idea.log after restarting IDE and reproducing the issue (you may use any online service or JetBrains FTP: https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems)?
Thank you Yaroslav. We use N-Able AV Defender and this was somehow causing interference between PyCharm and the Docker daemon.
Note that disabling AV Defender did not fix the problem. AV Defender had to be completely uninstalled from the Windows 10 PC in order to be able to use PyCharm integration with Docker on Windows.
We have raised the issue with N-Able but in the mean time I hope this information is of use to others who may be experiencing the same issues.
You are welcome!