http://www.littlebigextra.com/how-to-enable-remote-rest-api-on-docker-host/
Introduction
Docker provides remote REST API which is beneficial if you want to connect to a remote docker host. Few of the functions which you can achieve using Docker REST API over a simple browser are
Create and Manage Containers
Get low-level information about a container
Get Container Logs
Start/Stop container
Kill a container
My remote docker host was an Ubuntu Virtual Image on Microsoft Azure.
In this tutorial, I will show you
What didn’t worked?
What really worked.
Things that didn’t worked
Over the internet, most of the people have suggested editing DOCKER_OPTS variable.
I changed DOCKER_OPTS in the /etc/default/docker file but it didn’t have any effect
Then I tried changing DOCKER_OPTS in the file /etc/init/docker.conf but again no success.
What really worked for me to enable docker remote API on docker host
Navigate to /lib/system/system in your terminal and open docker.service file
vi /lib/systemd/system/docker.service
vi /lib/systemd/system/docker.service
Find the line which starts with ExecStart and adds -H=tcp://0.0.0.0:2375 to make it look like
ExecStart=/usr/bin/docker daemon -H=fd:// -H=tcp://0.0.0.0:2375
ExecStart=/usr/bin/docker daemon -H=fd:// -H=tcp://0.0.0.0:2375
Save the Modified File
Reload the docker daemon
systemctl daemon-reload
systemctl daemon-reload
Restart the container
sudo service docker restart
sudo service docker restart
Test if it is working by using this command, if everything is fine below command should return a JSON
curl http://localhost:2375/images/json
curl http://localhost:2375/images/json
To test remotely, use the PC name or IP address of Docker Host