How to Enable Docker Remote API
Docker Engine exposes a REST API which you can use to control your containers without the docker CLI. The API exposes equivalent functionality using HTTP network calls. You can script common Docker operations using your favorite programming language or remotely control one of your hosts. The CLI internally relies on the same API to provide its built-in commands.
Contents
Here are how to Enable Docker Remote API
Open docker.service located in /lib/systemd/system
1 |
vi /lib/systemd/system/docker.service |
Find the line which starts with ExecStart and disable by putting # before
Place this below
1 |
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock |
Save the Modified File
Reload the docker daemon
1 |
sudo systemctl daemon-reload |
Restart the container
1 |
sudo service docker restart |
Test if it is working
if everything is fine below command should return a JSON
1 |
curl http://localhost:2375/images/json |