I have a docker daemon/engine running inside guest
(Ubuntu) virtual machine
and as per Docker Tooling for Eclipse instruction I had downloaded and setup the plugin in Eclipse Mars on my host
Mac OS machine.
How do I connect to Docker running in guest VM from the host machine IDE.
As per instructions, I would need to enter TCP and authentication so how do I get these details to setup the connection?
I had tried with guest OS IP (i.e. tcp://127.0.0.1:2376
output of ifconfig command with local host IP) but was not able to connect.
Here are the steps I used to get Docker Tooling working in Eclipse Neon on Windows.
- Open the
Docker Quickstart Terminal
- Execute
docker-machine ls
- Copy the URL (e.g.
tcp://192.168.99.100:2376
)
- Click the
Add Connection
button in the toolbar for Docker Explorer
- Provide a
Connection name:
- Select
TCP Connection
- Paste the above URL into the
URI:
edit box
- Change
tcp
to https
in the edit box
- Select
Enable authentication
- Set the path to
C:\Users\
username\.docker\machine\certs
- Click on
Test Connection
to verify
There are two parts to this. First, enabling the TCP socket (which I'll answer). Then, setting TLS authentication on the socket (which I'll link to but won't cover). The first part should get you up.
You'll need to edit the DOCKER_OPTS
settings in /etc/default/docker
in the VM. Edit this file and set DOCKER_OPTS
to something like:
DOCKER_OPTS="-H tcp://0.0.0.0:2376 -H unix://"
Then, restart Docker (sudo service docker restart
). This should get you a TCP connection that you can put in your Eclipse settings as:
tcp://10.0.2.15:2376
The second part (which is optional at this point) would be setting up the CA and certificates per https://docs.docker.com/engine/articles/https/. But I'd actually recommend just installing Docker Machine and provisioning your VM that way as it will create the needed certificates for you. Then, if your machine was named dev
, you just point the authentication dir to ~/.docker/machine/machines/dev
.
If Docker Daemon is running(i.e docker desktop running) in window task bar , not inside the VM , just get the URI from its context menu setting. In eclipse docker tooling perspective , we can connect to running docker daemon only by providing the URI.