configure docker host with remote api on your linux machine


step 1: install docker engine. follow steps for your os from the docker documentation here – https://docs.docker.com/engine/install/

step 2: assuming that you’re using ubuntu, open the file docker.service located at the path /lib/systemd/system/docker.service

step 3: search for the line which says ExecStart. by default it should have something like this ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock . add the argument -H tcp://0.0.0.0:2376 to the dockerd command. the final command should look like this `ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 --containerd=/run/containerd/containerd.sock

step 4: we need to reload the systemd daemon and restart the docker service. use the command systemctl daemon-reload && systemctl restart docker.service to achieve this.

step 5: test the change. run curl -s http://<ip_address_of_host>:2376 this should spit out the json message showing docker versions. if this doesnt work, make sure the firewall allows you to connect to this port.

Leave a Reply

Your email address will not be published. Required fields are marked *