Q & A

Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: net/http: request can

问题描述

[root@localhost ~]# sudo docker login --username=*** 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@localhost ~]# sudo docker login --username=*** 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)

解决方案

vim /etc/resolv.conf

将dns修改为8.8.8.8

重启docker 服务

# Generated by NetworkManager
nameserver 8.8.8.8# Generated by NetworkManager
nameserver 8.8.8.8

登录验证

[root@localhost etc]# systemctl restart docker
[root@localhost etc]# sudo docker login --username=*** 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@localhost etc]# systemctl restart docker
[root@localhost etc]# sudo docker login --username=*** 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

容器有那么多问题,为什么还要使用容器技术?跑物理机不香吗?

  1. 对于应用,它容器化之后,发布和部署更加方便,特别是在扩容的时候更快了。
  2. 对于平台,我们用一套平台kubernetes来管理所有的应用,对于硬件资源的利用率得以提高。 所以容器化后,带来的好处是,开发效率的提高,资源利用率的提高。