简体   繁体   English

Docker容器上无互联网访问

[英]No internet access on docker container

I've just installed docker on a virtual machine and created a ubuntu container. 我刚刚在虚拟机上安装了docker并创建了一个ubuntu容器。 When I run "apt update" I get the following errors. 当我运行“ 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.

I already tried to enable the DOCKER_OPTS in /etc/default/docker to use Google's DNS and restarted docker, but it didn't work. 我已经尝试在/ etc / default / docker中启用DOCKER_OPTS以使用Google的DNS并重新启动docker,但是它没有用。

I also tried this: 我也试过这个:

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

How can I solve this problem? 我怎么解决这个问题?

Already solved it. 已经解决了。 What I had to do was comment out the 我要做的就是注释掉

dns=dnsmasq

entry located in /etc/NetworkManager/NetworkManager.conf . 条目位于/etc/NetworkManager/NetworkManager.conf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM