How to connect PyCharm to a python interpreter located inside a Docker container?

前端 未结 10 2188
再見小時候
再見小時候 2021-01-30 03:40

I\'m starting with Docker, but I don\'t know how to configure PyCharm to use a python interpreter located in a container.

It was easy to setup with Vagrant, but there\'s

10条回答
  •  时光说笑
    2021-01-30 04:07

    I don't think it's so bad to include SSH inside your container if you really need it. Yes, it's not essential in other use cases since the introduction of docker exec but since Intellij/PyCharm only support remote interpreter via SSH, it's OK.

    You can use phusion/baseimage as a good starting point to build your own container with SSH and any version of Python you need (it comes by default with PY3).

    Theoretically, it would be ideal to keep using Vagrant for this task as well, since it allows you to create a workflow that will work both on Windows/OS X machines (by using boot2docker) and Linux (native Docker).

    Practically I wasn't able to make it work on OS X because of the double NAT layer you have to pass in order to get into the SSH service, and it looks like it's not possible to add extra interface to the Vagrant boot2docker box (Vagrant 1.7.2).

提交回复
热议问题