I'm running Docker version 17.12.0-ce, build c97c6d6
on ubuntu 14.04
.
If I do
docker run -it busybox ping -c 1 www.google.com
It's working.
Now if I try
docker network create mynetwork
docker run -it --network mynetwork busybox ping -c 1 www.google.com
It's not working anymore.
I first thought of an internet access problem but with
docker run -it --network mynetwork busybox ping -c 1 216.58.201.228
it's working again.
So the problem seems to be a dns problem.
I remarked
docker run -it busybox cat /etc/resolv.conf
nameserver 213.186.33.99
search ovh.net
and
docker run -it --network mynetwork busybox cat /etc/resolv.conf
search ovh.net
nameserver 127.0.0.11
options ndots:0
And eventually
docker run -it --network mynetwork --dns 213.186.33.99 busybox ping -c 1 www.google.com
is also working.
Is it normal ? Reading the docker documentation I thought I had read that the resolv.conf of the host was 'mounted' in the container. Why not with the custom network ?
What's the solution ?