How to specify ports that the Docker API listens on

Document created by will.searle Expert on Apr 25, 2017Last modified by will.searle Expert on Apr 25, 2017
Version 2Show Document
  • View in full screen mode

To add Docker containers to Turbonomic, you need to make sure the Docker remote API is listening on a specified port.  Instructions on adding Docker containers to Turbonomic are in the target user guide here.  When you go to add Docker to Turbonomic you will have to specify this port for each container you add. By default the API is turned on for most Operating Systems, but if you want to change this follow the steps below.




In order to start the Docker remote API on Ubuntu systems you need to edit the /etc/init/docker.conf file and modify the DOCKER_OPTS segment to look like the string below:


DOCKER_OPTS='-H tcp:// -H unix:///var/run/docker.sock'


The port you specify in place of ‘xxxx’ above will be used by the Docker REST service.  Remember this port because you will need to specify this when you add the containers within the Turbonomic instance.  Save the docker.conf file and restart the Docker process using the following command:


‘Service Docker Restart’




For CoreOS systems you need to create a file called docker-tcp.socket within the /etc/system/system file path.  Edit the file so it matches the text below:  


Description=Docker Socket for the API 



ListenStream=XXXX – this should be the port you want the Docker API to respond to 






Save the file (shift + ZZ) and run the commands below to enable the Docker API to listen on the specified port. 


systemctl enable docker-tcp.socket

systemctl stop docker

systemctl start docker-tcp.socket

systemctl start docker 


Now you can verify that the new port is working by running: 


docker -H tcp:// ps 





Note the Remote API listens to requests over a named pipe on Windows and uses port 2375


If you would like to change the default port on Docker, you can edit the configuration for the docker daemon.  In order to do this you need to create a daemon.json file in the following directory: %ProgramData%\docker\config. 


In the file, create the configuration below.  Note that this setup is insecure as certificates are not in place.  If you want to protect the Docker daemon socket, follow the documentation here:


{   "hosts": ["tcp://"]}


You just need to edit the port in the line above to the custom port you want the Docker API to listen on.  Then save the file and restart the Docker Service.  You can do this by running “Restart-Service docker” in powershell. 






How to enable docker remote API in "Docker for Windows" - Stack Overflow 

1 person found this helpful