Docker 101 : Allowing external access to the local docker daemon - dockerd -
The docker daemon is usually run as a service on the local machine, we could check it using the below command:
We can communicate with the docker daemon using the CLI interface for example "docker ps" to list our containers.
The CLI uses the local Unix socket - /var/run/docker.sock - to communicate with the docker daemon.
To be able to communicate with our daemon from another machine, we would have to do it through a TCP socket/port - default docker port : 2375 - so the full address would be - docker_host_ip:2375 -.
To make it work, we would need to define the below environment variable:
Now we could use the command "docker ps" from our external host.
Securing your external connection from a remote host:
The below address connects to the docker host on the secure port "2376":
The port "2376" handles encrypted communications.
We could mention these when running docker manually using the "dockerd" command:
We need to create the above certificates for the server - servercert.pem, serverkey.pem - for the connection to go through