在Ubuntu 14机器上的Docker Ubuntu 16:没有互联网连接
我在我的机器上运行一个Ubuntu docker,但是当我inputapt-get update
命令时,它说:
root@50e964833537:/# apt-get 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 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.
我尝试了几个我find的“解决scheme”,但仍然不起作用。 我无法访问泊坞窗中的任何命令,因为我无法更新。 我想因为我的Docker没有访问互联网。 我怎样才能解决这个问题 ?
scheme:
我在公司networking中,所以我必须按照以下步骤更改DNS IP地址:
在主机上:
-
nm-tool | grep DNS
nm-tool | grep DNS
它会输出DNS服务器 -
sudo nano /etc/default/docker
并在第一步中使用DNS更改以下行:-
DOCKER_OPTS="--dns 'your_dns_server_1' --dns 'your_dns_server_2'"
-
- 重启docker:
sudo service docker restart