Fix cannot access internet in your docker container

I use docker for testing environment. Somehow I found out that the docker container cannot access the internet and the solution is really simple:

$ sudo ifconfig docker0 down
$ sudo service docker restart
$ sudo ifconfig docker0 up


$ sudo vim /etc/default/docker
DOCKER_OPTS="--dns --dns --dns"

Which: in my localhost/laptop