user4629729
user4629729

Reputation:

How to configure Docker to communicate over the network?

I am using the Ubuntu 14.04.1 LTS. How we can make docker deamon on the ubuntu host to listen the network port instead of default local unix port.

I am using following commands.

  1. Service docker stop
  2. docker -H 10.0.0.50:2375 -d &

response to the second command (docker -H 10.0.0.50:2375 -d &) was not expected

root@chandan-VirtualBox:/home/chandan# docker -H 10.0.0.50:2375 -d &
[1] 4169
root@chandan-VirtualBox:/home/chandan# INFO[0000] +job serveapi(tcp://10.0.0.50:2375)          
INFO[0000] Listening for HTTP on tcp (10.0.0.50:2375)   
INFO[0000] /!\ DON'T BIND ON ANOTHER IP ADDRESS THAN 127.0.0.1 IF YOU DON'T KNOW WHAT YOU'RE DOING /!\ 
listen tcp 10.0.0.50:2375: bind: cannot assign requested address
INFO[0000] -job serveapi(tcp://10.0.0.50:2375) = ERR (1) 
FATA[0000] listen tcp 10.0.0.50:2375: bind: cannot assign requested address 

I have checked the port 2375 is unassigned port. But still I am getting a the response right.

Upvotes: 1

Views: 1331

Answers (1)

Basav
Basav

Reputation: 3406

You will have to enable Docker to listen on remote API port

Try adding below line in the file

/etc/default/docker

DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock "

Exact steps can be summarised as below

sudo service docker stop
sudo vi /etc/default/docker #here you will added the options mentioned above
sudo service docker start

check if the port is now listening using this command

netstat -plt | grep 2375

Happy fixing

Upvotes: 2

Related Questions