Unfortunately Jetbrains’ docker plugin has not yet lived up to expectations — as anyone that’s been following this thread would know. Connecting to docker native requires numerous workarounds including bridging the docker unix socket to a TCP socket… because PyCharm refuses to connect to the former.

While most of the credit for this article goes to a gentleman by the name of Ben Last, and his post on a different Jetbrains thread, there were still a number of details left up to imagination. We’ve finally got a workable PyCharm/docker setup going at untapt. Here I’ll go through the steps that have worked for us. The solution is to inherit from your production docker image, run an ssh server, and use a PyCharm SSH remote interpreter setup. Imagining you’ve got a folder called dev in your repo, here are the scripts you need (once again, mostly copy-pasted from Ben’s work):

Ben’s post explains most of how this works. The key addition is to mount your project directory and pycharm_helpers into the container and then run sshd non daemonized. Now you can setup a PyCharm remote interpreter like this (note the username is root, this got me for a while too):