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

前端 未结 10 2167
再見小時候
再見小時候 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 03:59

    With Docker 1.3, use the exec command to construct the path to the Python interpreter:

    sudo docker exec container_name /usr/bin/python
    

    See https://docs.docker.com/reference/commandline/cli/#exec, http://forum.jetbrains.com/thread/PyCharm-2224

    You could install SSH inside the container and then expose the port, but that isn't how containers are expected to be used, because you would be bloating them.

提交回复
热议问题