I tried to find instructions on how to enable the Docker remote API when running Docker in Ubuntu 16.04, but none of the instructions I came across managed to take me all the way, so here are a few short notes on how I managed to accomplish this:
- Edit the file /lib/systemd/system/docker.service
I used the vi editor:
Shell1sudo vi /lib/systemd/system/docker.service
- Modify the line that starts with ExecStart to look like this:
1ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:4243
Where my addition is the “-H tcp://0.0.0.0:4243” part.
- Save the modified file.
- Make sure the Docker service notices the modified configuration:
- Restart the Docker service:
Shell1sudo service docker restart
- Test that the Docker API is indeed accessible:
You should see output similar to this as the result:
- To access the Docker API from another computer, use the IP address of the Ubuntu computer found at either wlan0 or eth0, depending on whether you use wifi or ethernet network connection.
To learn the IP addresses of the different interfaces, use the ifconfig command in a terminal window. In my case it is 192.168.1.68.
Finally, this screenshot shows how to set up access to the Ubuntu computer’s Docker API from inside IntelliJ IDEA with the Docker plug-in installed. I only modified the API URL and left the path to the certificates folder unchanged.