How to enable Docker remote API

at in tutorials


WHAT: Enable Dockers API to allow Docker to be controlled remotely.

HOW: Exposing Docker’s TCP port.

Docker Engine API allows you to do basically everything you do from the command line but from an API interface which is crucial in many scenarios, especially for automation and orchestration.

1. Expose Docker’s TCP port

It might differ from distro to distro, so in case it is not the same as one of these examples, try to find similar configuration parameter in the specific configuration file from your distro.

Ubuntu 14.04

In /lib/systemd/system/docker.service

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://

Ubuntu 16.04

/etc/default/docker or /etc/default/

DOCKER_OPTS="-H tcp:// -H unix:///var/run/docker.sock"


ExecStart=/usr/bin/dockerd -H tcp:// -H unix:///var/run/docker.sock

Restart the services

You will need to restart the services to check the changes.

sudo systemctl daemon-reload
sudo service docker restart

If you get something like this:

systemctl: command not found

You need to install systemd package.

sudo apt-get install systemd -y


Now to ensure the API is accessible, send a request to verify the version. These commands are being executed inside the Docker host.

curl http://localhost:4243/version

You should see something like this:


And it is done!