Ubuntu docker容器上没有internet访问

Ubuntu docker容器上没有internet访问,ubuntu,docker,internet-connection,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 reso

我刚刚在虚拟机上安装了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使用谷歌的DNS并重新启动了DOCKER,但没有成功

我也试过:

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

我怎样才能解决这个问题?

已经解决了。我所要做的就是把这篇文章注释掉

dns=dnsmasq

位于
/etc/NetworkManager/NetworkManager.conf

中的条目您对
DOCKER\u OPTS
做了哪些更改?您如何验证更改是否处于活动状态?使用
ps
验证Docker守护进程是否正在使用您配置的选项运行,并查看容器中的
/etc/resolv.conf
,查看
名称服务器设置是否正确。