I can't find any certificate files created by Docker Beta for Mac
. I need it for my IDE connection to Docker.
问题:
回答1:
I installed the Docker Beta for Mac and found no ~/.docker/ directory.
As mentioned in "Docker for Mac vs. Docker Toolbox¶"
With Docker for Mac, you get only one VM, and you don’t manage it.
It is managed by the Docker for Mac application, which includes autoupdate to update the client and server versions of Docker.If you need several VMs and want to manage the version of the Docker client or server you are using, you can continue to use
docker-machine
So you will see certs in ~/.docker/machine
only if you decide to create your own.
With the new Docker for Mac setup, check if there are any certificates in /Applications/Docker.app/
(as in /Applications/Docker.app/Contents/Resources
)
If you rely on the default HyperKit, then there is no need for certificate in order to contact the VM with docker command.
As illustrated by the comments below (and the OP Kroderia's answer), the default VM is only accessed through /var/run/docker.sock
.
As Ellis comments below, that can be a challenge for some software like PyCharm:
when it (PyCharm) tries to connect it produces:
Cannot connect: javax.ws.rs.ProcessingException:
Could not initialize class org.newsclub.net.unix.NativeUnixSocket"
Issue 153973 suggests:
This is due to that Docker plugin is bundled in PyCharm. It could be updated manually but even with Docker 2.3.1 the problem with Docker Python interpreter will not be fixed.
The next PyCharm 2016.2 EAP with the fix is on its way.The workaround with
socat
you described will be available in the next PyCharm 2016.2 EAP. The next EAP will be released soon with the updated Docker plugin version.
socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock
回答2:
@VonC takes the best answer.
I just wanna to provide my solution about this question. The question is about using a connection to manage docker. In fact I am using Docker Integration
in IntelliJ.
- As mentioned in Docker for Mac vs. Docker Toolbox
At installation time, Docker for Mac provisions an HyperKit VM based on Alpine Linux, running Docker Engine. It exposes the docker API on a socket in
/var/tmp/docker.sock
However, it's not the truth, the real socket path is /var/run/docker.sock
. You can now use unix:///var/run/docker.sock
as API URL in Docker Integration
, not certificate files are needed.
Guess what,
Docker Integration
ver 2.2.*, which works in the stable build(2016.1), failed with unix connection in Mac and got fixed in ver 2.3.1, which works in the preview build(2016.2). Which means if you want to make it works properly, you will need to update your IntelliJ to the preview build and install the newest plugin.Here's the worst thing. The
Docker Integration
ver 2.3.1 gotNullPointerException
when deploying the Dockerfile, which works in the stable version of IntelliJ andDocker Integration
ver 2.2.* viahttp
connection. I have sent an email to the plugin author and waiting for a furthur solution.
回答3:
Spent the last few hours, but it's finally working:
- downloaded pycharm early access program
- setup docker hub registry as described here
- pycharm -> preferences -> project interpreter -> add remote -> Docker compose.