docker remote api

How To Enable Docker Remote API

You will need Docker remote API in various situations. Let’s say you are running the docker host on a remote server and you want to connect to it from your laptop. For this scenario, you can use the remote API and connect to it using REST API’s as the docker engine accepts REST requests.

One more use case is that let’s say you have an application and you want to get the details of the containers in docker host. For this, you can use the remote API feature.

Enable Docker Remote API

All the docker configurations are present in the file/lib/systemd/system/docker.service. In that file, there is an ExecStart parameter.

Open the file/lib/systemd/system/docker.service, search for ExecStart and add values as shown below.

For Ubuntu,

For Centos/Redhat,

The above command will bind the docker engine server to the Unix socket as well as TCP port 4243. “” means docker-engine accepts connections from all IP addresses.

Related Courses

  1. Docker Mastery: The Complete Toolset From a Docker Captain
  2. Learn DevOps: The Complete Kubernetes Course

Now for all the changes to take place, you need to restart the daemon and Docker service. Execute the following commands to do that.

Now, remote API is enabled on your docker host. To test this, there are few ways.

Test using curl

Get the IP address of your docker host where you enabled remote API and execute the following command from any terminal which supports curl. You can test with localhost as well.

Note: replace the IP with your Docker host IP or localhost as shown below.

The above command will output all the images in your docker host in JSON format.

You Might Like: Docker Useful Hacks

Test using REST client

You can test the API using REST client like Postman. If you use the following URL in your REST client, you will get the JSON output in a prettified manner as shown in the image below.

enable docker remote API

In this tutorial, you learned to enable Docker remote API. For better security, you can use certificated with the REST requests. That we will cover in another detailed post If you face any issues with this setup, let us know in the comments section.


docker cheat sheet - beginners guide

Docker has many commands to remember. If you are starting up with docker, We are pretty sure that you will have a hard…

Read more

There are few situations in which you might want to get into the container shell or may be run a single command in a…

Read more

The Best Tutorials & Tips to Speedup Your DevOps Workflow.

Created by Bibin Wilson.