从requirements.txt下载软件包时Docker“入门教程”卡住了。 我该怎么办?

我正在学习这个教程, https://docs.docker.com/get-started/part2/#build-the-app 。

在我需要运行这个部分, docker build -t friendlyhello . ,我跑sudo docker build -t friendlyhello . 而是因为我还没有专门为Docker设置适当的组和用户。

我的设置卡在这个部分…

 Step 4/7 : RUN pip install -r requirements.txt ---> Running in 74c38677ecc3 Collecting Flask (from -r requirements.txt (line 1)) Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fee6c92d150>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/ 

我不认为防火墙或ISP是问题,因为我可以直接从我的主机Ubuntu 16.04使用sudo pip install flask直接访问Flask。

这个问题的解决办法是什么?

更改docker的DNSconfiguration或您的机器DN​​S可能会解决这个问题,

检查: 不能在Ubuntu的docker容器内安装pip包

好吧,这是突然的工作。

我在我的本地图书馆,正如我之前提到的sudo pip install flask运行良好。 但是,从Docker中,它返回了我在这里提到的错误。 我试图关机/重新启动它仍然是一样的。

然后,我刚回到家,运行相同的命令(从完全closuresUbuntu 16.04机器),它只是工作。

我从@misraX给我的链接什么都没做。 这是来自Docker的所有默认的全新安装设置。