Enable Docker Remote Api on Docker Host
Docker engine has inbuild API service that allows you to control & modify your docker engine and docker instance using HTTP.
To do that:
- Navigate to
/lib/systemd/system
in your terminal and opendocker.service
filesudo vim /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 likeExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H=tcp://0.0.0.0:2375
:wq
Save the modified file- Reload the docker daemon
sudo systemctl daemon-reload
- Restart the container
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/services
- Ensure the port is open in your firewall
sudo ufw allow 2375/udp
- you also test it with
curl http://192.168.99.120:2375/services