I have been playing around with Docker lately in my home lab and have primarily been using the Docker CLI. While going through the documentation, I found that Docker also provides a nice remote REST API which by default, seems to be disabled. I was searching online but could not find any tutorials that provides clear instructions on how to enable the remote API for an Ubuntu Virtual Machine that I recently built to run Docker.
With some trial and error, I was able to finally figure out what was needed and figure I would document this for myself and for anyone else who maybe interested.
If you have Docker running on an Ubuntu (14.04 is what I'm using), you will need to edit /etc/init/docker.conf and update the DOCKER_OPTS variable to the following:
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
This will have Docker bind to port 4243 which will be used by the Docker Remote API. One you have saved your changes, you will need to restart the Docker process by running the following command:
service docker restart
To test that the Docker Remote API has been properly enabled, we will list the Images currently in Docker (this assumes you have at least pulled down one image from the Docker Hub Registry).
In my environment, I have the following Docker Images:
Using my Firefox browser and the RESTClient plugin, I can perform a GET operation on the following URL: http://172.30.0.199:4243/images/json as described in the Docker Remote API.
curl -X GET http://172.30.0.199:4243/images/json
If you are running CoreOS (which I also have running in my vSphere environment), you can enable the Docker remote API by following the documentation here. Hopefully this will be helpful for anyone looking to enable the Remote API but not able to find the exact steps.