Docker容器上没有互联网接入

时间:2016-11-02 11:22:35

标签: ubuntu docker internet-connection

我刚刚在虚拟机上安装了docker并创建了一个ubuntu容器。当我运行" apt update"我收到以下错误。

Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done        
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

我已经尝试启用/ etc / default / docker中的DOCKER_OPTS来使用Google的DNS并重新启动docker,但它没有用。

我也试过这个:

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

已经解决了。我要做的就是评论

dns=dnsmasq

条目位于/etc/NetworkManager/NetworkManager.conf