Docker配置阿里云镜像后仍报错问题
Kubernetes需要使用docker作为运行时,在Linux机器上安装docker后,尝试拉取hello-world镜像时出现问题 安装docker时一切都很顺利: sudo apt update sudo apt install docker.io sudo systemctl start docker sudo systemctl enable docker 但在进行docker pull hello-world拉取镜像时报错: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceed ed while awaiting headers) 解决方法 首先需要更换docker源,这里使用阿里云镜像加速器与另一个自己收集的源。进入/etc/docker/daemon.json文件中如此配置: { "registry-mirrors": [ "https://ok5mwqnl.mirror.aliyuncs.com", "https://docker.1ms.run" ] } 配置完成后执行sudo systemctl restart docker重启docker服务 重启后运行docker pull hello-world仍失败,报错信息与先前一致 这时考虑DNS配置问题,进入/etc/resolv.conf文件,在原有的若干nameserver之上再增加两条: # Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.4.4 # 此处为原有的若干行nameserver # ... 配置完成后运行docker pull hello-world,成功拉取镜像,执行sudo docker images查看本地镜像: ...