docker login 阿里云失败??

docker login 阿里云失败??

首先参考 阿里云官方文档《Docker登录、推送和拉取失败常见问题

看看是否是下面提到的情况:

在这里插入图片描述

我遇到的情况是超时:

[root@k8snode1 software]# sudo docker login --username=tyleryun registry.cn-hangzhou.aliyuncs.com
Password: 
Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@k8snode1 software]#

于是我怀疑是网络连不通 阿里云仓库地址,我就 ping 了一下阿里云地址:
在这里插入图片描述

发现是可以 ping 通的,但是就是在 ping 命令回车后,需要等个几秒钟,才有数据响应。就是我的域名解析可能有点慢,所以导致超时。

所以我干脆自己把阿里云仓库地址的 IP 和 域名 映射 写到我的 /etc/hosts 文件下, 这样就减少了域名解析的时间。

首先使用 dig 工具找到 阿里云仓库地址(registry.cn-hangzhou.aliyuncs.com) 对应的 IP, 然后再使用 ping 命令检测能否 ping 通该 IP。

dig registry.cn-hangzhou.aliyuncs.com

在这里插入图片描述

编辑 /etc/hosts 文件

vi /etc/hosts

在最后一行添加 阿里云仓库地址 IP 和 域名 的映射,保存退出!
在这里插入图片描述
再次登录,登录成功。

[root@k8snode1 software]# sudo docker login --username=tyleryun registry.cn-hangzhou.aliyuncs.com
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[root@k8snode1 software]#

相关推荐

  1. 阿里服务器执行yum,一直下载docker-ce-stable失败

    2024-03-17 04:56:02       16 阅读
  2. 阿里公有平台

    2024-03-17 04:56:02       34 阅读
  3. 阿里腾讯

    2024-03-17 04:56:02       36 阅读
  4. 阿里docker加速

    2024-03-17 04:56:02       34 阅读
  5. 阿里安装docker

    2024-03-17 04:56:02       37 阅读
  6. 阿里OCR识别

    2024-03-17 04:56:02       29 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-17 04:56:02       14 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-17 04:56:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-17 04:56:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-17 04:56:02       18 阅读

热门阅读

  1. CS255#1代码

    2024-03-17 04:56:02       19 阅读
  2. Python 数据结构与算法

    2024-03-17 04:56:02       21 阅读
  3. MySQL锁

    MySQL锁

    2024-03-17 04:56:02      16 阅读
  4. mysql 存储过程 每天凌晨 定时执行任务(存储过程)

    2024-03-17 04:56:02       16 阅读
  5. MySQL 读写分离中的过期读问题及其解决方案

    2024-03-17 04:56:02       21 阅读
  6. 【C#】轻松理解AutoResetEvent 和 ManualResetEvent

    2024-03-17 04:56:02       17 阅读
  7. Unity如何让游戏程序读写资源文件?

    2024-03-17 04:56:02       15 阅读