安装docker遇到的坑 Could not resolve host: download.docker.com;
我写的
1.编辑网卡
vim /etc/sysconfig/network-scripts/ifcfg-ens33
" class="reference-link">
2.增加这三行
DNS1=8.8.8.8
DNS2=114.114.114.114
PEERDNS=no
" class="reference-link">
" class="reference-link">
3.最后重启网络service network restart 即可。不行就重启虚拟机
4.设置稳定的源
yum-config-manager \
—add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
上面这步网络不稳定会设置失败,需要多试几次
有可能还需要看这篇自己的博客
https://blog.csdn.net/qq_27327261/article/details/108834992
https://blog.csdn.net/weixin_43275277/article/details/108321681
解决:Could not resolve host: download.docker.com; 未知的错误
码农小麦 2020-08-31 15:11:01 370
收藏 2
分类专栏: 解决方案 文章标签: docker 网络
版权
虚拟机添加docker的repo时报此错误:Could not resolve host: download.docker.com; 未知的错误
可以看出是无法解析域名,在网卡中添加DNS1=8.8.8.8,DNS2=114.114.114.114,并设置PEERDNS=“no”。
然后重启网络即可,systemctl restart network。
https://blog.csdn.net/qq_41833455/article/details/106324492
docker在线安装错误提示:Could not resolve host…..
渣渣毛 2020-05-25 00:33:44 1000
收藏
分类专栏: 异常处理 文章标签: yum docker linux centos java
版权
1.问题描述
参考docker官方安装手册安装时,执行此yum安装工具命令
出现以下报错:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
device-mapper-1.02.158-2.el7_7 FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/device-mapper-1.02.158-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
device-mapper-event-1.02.158-2 FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/device-mapper-event-1.02.158-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
device-mapper-event-libs-1.02. FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/device-mapper-event-libs-1.02.158-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
device-mapper-libs-1.02.158-2. FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/device-mapper-libs-1.02.158-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
lvm2-2.02.185-2.el7_7.2.x86_64 FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/lvm2-2.02.185-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
lvm2-libs-2.02.185-2.el7_7.2.x FAILED
http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/lvm2-libs-2.02.185-2.el7_7.2.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; Unknown error"
正在尝试其它镜像。
Error downloading packages:
7:lvm2-libs-2.02.185-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
7:device-mapper-libs-1.02.158-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
7:device-mapper-event-1.02.158-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
7:device-mapper-event-libs-1.02.158-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
7:device-mapper-1.02.158-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
7:lvm2-2.02.185-2.el7_7.2.x86_64: [Errno 256] No more mirrors to try.
2.解决办法
经过自己各种查找、尝试(离线安装法),此问题和虚拟机DNS设置有关:
(1)首先利用查看ip的方式查看当前应该修改哪个配置文件
如上,我用的是ens33(每台电脑都不大相同)
(2)接着找到如下命令对应位置(我这里是ens33),设置DNS1=8.8.8.8,最后重启网络service network restart 即可。
vim /etc/sysconfig/network-scripts/ifcfg-ens33
https://blog.csdn.net/wangpeng2011314/article/details/105152356
安装docker遇到的坑
wangpeng2011314 2020-03-27 22:56:06 518
收藏
分类专栏: 技术贴
版权
1.docker只支持centos7以上的系统,所以刚开始用了一台centos6.8的服务器失败了
2.如果有的话,删除旧的版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
3.安装所需的软件包。yum-utils 提供了 yum-config-manager ,并且 device mapper 存储驱动程序需要 device-mapper-persistent-data 和 lvm2。
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
4.设置稳定的源
yum-config-manager \
—add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
上面这步网络不稳定会设置失败,需要多试几次
5.安装最新版本的 Docker Engine-Community 和 containerd
yum install docker-ce docker-ce-cli containerd.io
同样因为网络原因,会失败,我这里失败的原因是:
docker-ce-stable/x86_64/update FAILED
https://download.docker.com/linux/centos/7/x86\_64/stable/repodata/65c4f66e2808d328890505c3c2f13bb35a96f457d1c21a6346191c4dc07e6080-updateinfo.xml.gz: [Errno 14] curl#6 - “Could not resolve host: download.docker.com; Name or service not known”
解决办法:单独下载N次直到成功
wget https://download.docker.com/linux/centos/7/x86_64/stable/repodata/65c4f66e2808d328890505c3c2f13bb35a96f457d1c21a6346191c4dc07e6080-updateinfo.xml.gz
成功后再试上面的命令就可以安装了
6.启动docker
systemctl start docker
7.测试一下
docker run hello-world
结果:
[root@iZuf6bzvz55uz2qm19or1yZ tools]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
docker: error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/fc/fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e/data?verify=1585323786-ZG%2BMZ%2FW5B%2B3su95dTQyGPFfb0vY%3D: read tcp 172.19.65.217:43764->104.18.122.25:443: read: connection reset by peer.
See 'docker run --help'.
同样因为网络问题,失败了
解决办法:
配置镜像加速器
在 /etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件)
{"registry-mirrors":["https://registry.docker-cn.com"]}
之后重新启动服务:
systemctl daemon-reload
systemctl restart docker
结果:
[root@iZuf6bzvz55uz2qm19or1yZ tools]# docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
1b930d010525: Already exists
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
- The Docker client contacted the Docker daemon.
- The Docker daemon pulled the “hello-world” image from the Docker Hub.
(amd64) - The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading. - The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
就成功了!
还没有评论,来说两句吧...