Docker engine has inbuild API service that allows you to control & modify your docker engine and docker instance using HTTP.

To do that:

  1. Navigate to /lib/systemd/system in your terminal and open docker.service file sudo vim /lib/systemd/system/docker.service
  2. Find the line which starts with ExecStart and adds -H=tcp:// to make it look like ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H=tcp://
  3. :wq Save the modified file
  4. Reload the docker daemon sudo systemctl daemon-reload
  5. Restart the container sudo service docker restart
  6. Test if it is working by using this command, if everything is fine below command should return a JSON curl http://localhost:2375/services
  7. Ensure the port is open in your firewall sudo ufw allow 2375/udp
  8. you also test it with curl