Wednesday, February 21, 2018

How to Enable Docker Remote API on Ubuntu 16.04?

Please find below steps for enabling Docker Remote API on Ubuntu 16.0.4. You would need Docker API in order to access Docker containers running on the Docker Host. You can enable by modifying the /lib/systemd/system/docker.service.

Pre-requistes:

port 4243 opened in security firewall

1. sudo vi /lib/systemd/system/docker.service
Look for the text that says

ExecStart=/usr/bin/dockerd -H fd:// 

Now append like below:

ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4243

save the file and exit.

Now update the configuration in order for Docker daemon to take the changes effect.
systemctl daemon-reload

Restart Docker service
sudo service docker restart

Now test whether Docker API is accessible

curl http://localhost:4243/version

You will see below output:

{"Platform":{"Name":""},"Components":[{"Name":"Engine","Version":"17.12.0-ce","Details":{"ApiVersion":"1.35","Arch":"amd64","BuildTime":"2017-12-27T20:09:53.000000000+00:00","Experimental":"false","GitCommit":"c97c6d6","GoVersion":"go1.9.2","KernelVersion":"4.4.0-1049-aws","MinAPIVersion":"1.12","Os":"linux"}}],"Version":"17.12.0-ce","ApiVersion":"1.35","MinAPIVersion":"1.12","GitCommit":"c97c6d6","GoVersion":"go1.9.2","Os":"linux","Arch":"amd64","KernelVersion":"4.4.0-1049-aws","BuildTime":"2017-12-27T20:09:53.000000000+00:00"}

No comments:

Post a Comment