Docker Desktop无法从容器访问网络

时间:2019-10-07 13:36:55

标签: windows docker

尝试了在社区中找到的几乎所有尝试,但没有弄清楚如何通过在Docker桌面环境中创建的容器访问Web。

这是我最后一次尝试使用Ubuntu(也尝试过Centos和Debian套件):

docker run -i -t --rm=true ubuntu /bin/bash
root@310f7a660efd:/# apt-get update -y
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Could not connect to archive.ubuntu.com:80 (91.189.88.24). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.173). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.174). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.162). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.31). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.149). - connect (111: Connection refused)
Err:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Unable to connect to archive.ubuntu.com:http:
Err:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Unable to connect to archive.ubuntu.com:http:
Err:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.91.14). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.24). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.162). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.31). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.174). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.26). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.24). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.23). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.173). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.149). - connect (111: Connection refused)
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not connect to archive.ubuntu.com:80 (91.189.88.24). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.173). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.174). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.162). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.31). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.149). - connect (111: Connection refused)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.91.14). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.24). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.162). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.31). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.174). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.26). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.24). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.23). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.173). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.88.149). - connect (111: Connection refused)
W: Some index files failed to download. They have been ignored, or old ones used instead.

如果我从服务器ping google.com没问题,但是无法访问存储库。 似乎是代理问题,但仅仅是因为我在Docker设置中设置了代理,它才允许我从dockerhub下载映像。 还尝试将DNS固定为8.8.8.8。 我的操作系统是Windows 10,这是Docker信息:

Client:
 Debug Mode: false

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 19.03.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894--------------16b8817763c29fb
 runc version: 425e105d5a03----------9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.952GiB
 Name: docker-desktop
 ID: UL2M:2GDU:GGIH:IO6C:EJWA:YUXM:5DFL:F6Q4:XTFE:K3MN:7474:TY4J
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 38
  Goroutines: 58
  System Time: 2019-10-07T13:34:51.1886632Z
  EventsListeners: 1
 HTTP Proxy: xxxxxxxxxxxxxxxx:3128
 HTTPS Proxy: xxxxxxxxxxxxxxxx:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

这是一个非常可悲的情况,因为如果容器无法访问网络,那将是非常有限的。

此外,如果我将这些堆栈中无法访问的路径放在chrome中,则它们完全可用。

希望能给我一些正确的指导。

0 个答案:

没有答案