Docker listening on a tcp port

In Docker to allow Docker clients to access the Docker server (daemon) over the network you have to switch the Docker daemon from using a local socket to a tcp port.


First make sure docker is stopped:


$service docker stop


In the training I watched the command was:


$docker –H IPaddress:Port –d &


For example:


$docker –H –d &


2375 being the default non-ssl port.


This didn’t work for me and after digging around I found the latest syntax for this line looks like:


$docker daemon –H &


My advice though is run the daemon on both the socket and the tcp port as for testing its easier when you are on the docker host system. The command to do this is:


$docker daemon –H unix:///var/run/docker.sock –H &


You may receive an error about an existing file that exists in /var/run . I just deleted using:


$rm /var/run/


Then run the previous command again to fire up Docker on both socket and tcp port.


$docker daemon –H unix:///var/run/docker.sock –H &