Pycharm docker remote python interpreter

2019-05-15 18:06发布

问题:

When trying to configure a Remote Python Interpreter in Pycharm using Docker I get the following error:

com.github.dockerjava.api.excepion.DockerClientException: Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '/Users/me/.docker/machine/machines/default' doesn't exist.

I've $export DOCKER_TLS_VERIFY=0 but with no difference. I've manually created '/Users/me/.docker/machine/machines/default' but with no joy.

I've deinstalled and reinstalled both Docker and Pycharm but still get the same error.

I'm on a Mac OSX 10.12.1 Pycharm 2016.3

Full disclosure: I use vagrant and virtual box on my mac too.

Any pointers would be appreciated. Kevin

回答1:

I fixed it as follows:

Obtain socat (if not already installed)

e.g. brew install socat

Then: socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock

Then in pycharm/docker config: Api URL: tcp://localhost:2375

Many thanks to the following found on: https://youtrack.jetbrains.com/issue/IDEA-153973



回答2:

If you have been using docker-machine for Mac to support PyCharm or the "socat" hack to access Docker API - It is no longer necessary with PyCharm EAP (https://www.jetbrains.com/pycharm/nextversion/) — You can set your remote debugger API_URL directly to: unix:/var/run/docker.sock (supporting debug mode, and the environment runs a lot faster, when not using VirtualBox).

There is a no-questions-asked 30 day trial of EAP before that update goes live (some time this month)