Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.neusoft.edu.cn\’\”
Trying other mirror.
http://mirrors.nwsuaf.edu.cn/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.nwsuaf.edu.cn\’\”
Trying other mirror.
http://mirrors.shu.edu.cn/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.shu.edu.cn\’\”
Trying other mirror.
http://mirrors.sohu.com/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.sohu.com\’\”
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.tuna.tsinghua.edu.cn\’\”
Trying other mirror.
http://mirrors.zju.edu.cn/centos/6.10/extras/x86_64/Packages/epel-release-6-8.noarch.rpm: [Errno 14] PYCURL ERROR 6 – \”Couldn\’t resolve host \’mirrors.zju.edu.cn\’\”
Trying other mirror.
測試wget
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
結(jié)果報(bào)錯(cuò)
unknown host mirrors.163.com
測試ping
在容器內(nèi)部
ping www.baidu.com
結(jié)果還是失敗
ping: unknown host www.baidu.com
多開一個(gè)終端,進(jìn)入主機(jī)(不是進(jìn)入容器),進(jìn)行ping命令測試發(fā)現(xiàn)是OK的,基本可以確定是docker的問題了,而不是網(wǎng)絡(luò)問題
解決方法
停止所有容器,重啟docker
service docker restart
內(nèi)容擴(kuò)展
Docker容器內(nèi)不能聯(lián)網(wǎng)的6種解決方案
1.使用–net:host選項(xiàng)
2.使用–dns選項(xiàng)
3.改dns server
4.不用dnsmasq
5.重建docker0網(wǎng)絡(luò)
6.直接在docker內(nèi)修改/etc/hosts
關(guān)于“如何解決docker容器無法ping外網(wǎng)的問題”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。
更多關(guān)于云服務(wù)器,域名注冊,虛擬主機(jī)的問題,請?jiān)L問西部數(shù)碼官網(wǎng):ps-sw.cn