I'm using a Vagrant VM with the following in Vagrantfile: config.vm.network :private_network, ip: "192.168.2.123"
The following is iptables:
# Generated by iptables-save v1.4.12 on Sun Aug 4 01:24:46 2013*filter :INPUT ACCEPT [1974:252013]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [1511:932565]-A INPUT -p tcp -m tcp --dport 4243-j ACCEPT COMMIT # Completed on Sun Aug 4 01:24:46 2013# Generated by iptables-save v1.4.12 on Sun Aug 4 01:24:46 2013*nat :PREROUTING ACCEPT [118:8562]:INPUT ACCEPT [91:6204]:OUTPUT ACCEPT [102:7211]:POSTROUTING ACCEPT [102:7211]:DOCKER -[0:0]-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER -A OUTPUT !-d 127.0.0.0/8-m addrtype --dst-type LOCAL -j DOCKER -A POSTROUTING -s 172.16.42.0/24!-d 172.16.42.0/24-j MASQUERADE
回答1:
Came across a similar issue, one thing I don't see mentioned here is you need to start docker to listen to both the network and a unix socket. All regular docker (command-line) commands on the host assume the socket.
IP-ADDRESS - any address which is accessible can be used.
Restart the docker service after configuring the port.
The reason for adding both the user port[ tcp://127.0.0.1:5000] and default docker socket[unix:///var/run/docker.sock] is that the user port enables the access to the docker APIs whereas the default socket enables the CLI.