ubuntu docker https://registry-1.docker.io/v2/

ubuntu使用docker报错https://registry-1.docker.io/v2/

错误情况

在使用docker pull 或者docker search ,报错:

Error response from daemon: Get "https://index.docker.io/v1/search?q=nginx&n=25": dial tcp: lookup index.docker.io: Temporary failure in name resolution

执行:apt-get update 也会报错

错误:1 http://mirrors.aliyun.com/ubuntu jammy InRelease
  暂时不能解析域名“mirrors.aliyun.com”
错误:3 http://security.ubuntu.com/ubuntu jammy-security InRelease                                         
  暂时不能解析域名“security.ubuntu.com”
错误:2 https://download.docker.com/linux/ubuntu jammy InRelease                                           
  暂时不能解析域名“download.docker.com”
错误:4 https://deb.nodesource.com/node_14.x jammy InRelease            
  暂时不能解析域名“deb.nodesource.com”
错误:5 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease
  暂时不能解析域名“mirrors.aliyun.com”
错误:6 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease
  暂时不能解析域名“mirrors.aliyun.com”
正在读取软件包列表... 完成
W: 无法下载 http://mirrors.aliyun.com/ubuntu/dists/jammy/InRelease  暂时不能解析域名“mirrors.aliyun.com”
W: 无法下载 http://mirrors.aliyun.com/ubuntu/dists/jammy-updates/InRelease  暂时不能解析域名“mirrors.aliyun.com”
W: 无法下载 http://mirrors.aliyun.com/ubuntu/dists/jammy-backports/InRelease  暂时不能解析域名“mirrors.aliyun.com”
W: 无法下载 http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  暂时不能解析域名“security.ubuntu.com”
W: 无法下载 https://download.docker.com/linux/ubuntu/dists/jammy/InRelease  暂时不能解析域名“download.docker.com”
W: 无法下载 https://deb.nodesource.com/node_14.x/dists/jammy/InRelease  暂时不能解析域名“deb.nodesource.com”
W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

尝试过各种办法都无法解决,使用下面方法解决:

步骤

vi /etc/resolv.conf

在最后添加:

nameserver 8.8.8.8
nameserver 8.8.4.4

最后在执行:

systemctl restart docker 

重试后正常,此时在运行apt-get update 也正常。

猜你喜欢

转载自blog.csdn.net/zhijiesmile/article/details/130344458