Sometimes you need to connect to the docker engine without direct access to the console – whether remotely via TCP or via an application (such as Eclipse).
To do this, we must enable a listener in the Docker daemon. To do this, we have to create an overrides file for sysctl, adding the extra required startup parameters.
I’m assuming a RHEL 7 based system (should work well on RHEL, CentOS, Fedora)..
1) Create the following directory
/etc/systemd/system/docker.service.d/
2) Create an overrides file for the socket (can be named anything, and you can have multiple files)
I created the file: daemon.conf with the following entries:
[Service] ExecStart= ExecStart=/usr/bin/docker daemon -H fd:// -H unix:///var/run/docker.sock
This creates a local unix socket that my Eclipse instance can connect to and interact with the docker service using REST apis.
You can see the default service configuration in this file: /lib/systemd/system/docker.service
3) Reload sysctl config
$ systemctl daemon-reload
4) Configure your user
sudo usermod -aG docker rkpatel
This adds my user(rkpatel) to the docker group, which owns the socket. This also allows you to run docker commands without issuing sudo.
You may need to log out/in before the changes are fully realised.
NOTE: This does elevate your user account privileges and it may be possible to access some files previously accessible to only root.- check the docker documentation for full details.