dotcloud/docker — pull request #2295 by viirya (2013-10-18 21:39:09+00:00)
Title: fix the conflict between nameserver settings and the network used by bridge interface

When launching docker in docker on a vm, there is a bug that the nested docker may choose a docker network that conflicts with vm's network. This pull request fixes this problem.

Specifically, suppose the vm uses 10.0.XX and has 10.0.4.1 as its nameserver. The first launched docker will avoid that and choose 172.17.42.1/16 as its network. That is no problem.

When we launch nested docker in the first docker, the nested docker only sees the route table of first docker (172.17.42.1/16), so it will choose 10.0.42.1/16 in func CreateBridgeIface as its network. Although there is no conflict between two networks, the chosen network of nested docker will conflict with the nameserver (10.0.4.1) of original vm.

Thus, the network of nested docker can not work well since its dns lookup requests can not reach correct destination.

This commit adds additional check of nameserver settings in func CreateBridgeIface when choosing docker network.