简体   繁体   中英

Boot2Docker: how to access container with Bridged Networking

I am running Boot2Docker in Virtual Box on Windows, using VB bridged networking. The IP address of my PC (192.168.2.2) and of the VM (192.168.2.30) is determined by the DHCP server.

I have configured the docker bridge as follows:

File /var/lib/boot2docker/profile: EXTRA_ARGS='--bip=192.168.2.192/25 --fixed-cidr=192.168.2.224/27'

From my Windows PC I can successfully ping the folloing IP addresses: 192.168.2.30 (ip address of eth1 in the Docker Host) 192.168.2.192 (ip address of docker0)

However I cannot ping any container that I start. Eg for container IP 192.168.2.226, I get a reply from 192.168.2.2 (my PC address) that the Desitination Host is unreachable.

How can I get this to work?

I figured it out in the meantime:

On Windows 7, from an elevated cmd shell do: route add 192.168.2.224/27 192.168.2.30

This way the IP packets find their way to the containers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM