10

#docker 登录私有docker镜像库报错:server gave HTTP response to HTTPS client

 2 years ago
source link: https://xmanyou.com/gitlab-docker-private-registry-gave-http-response-to-https-client/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
10 March 2021 / docker

#docker 登录私有docker镜像库报错:server gave HTTP response to HTTPS client

在内网通过gitlab搭建了一个docker镜像库,但是在使用docker登录时,却报了这么个错误:

docker login 192.168.1.12:49264
Username: zhangzhibin
Password:

Error response from daemon: Get https://192.168.1.12:49264/v2/: http: server gave HTTP response to HTTPS client

从错误描述来看,错误的来源是docker daemon。

错误的原因是,

  • docker客户端默认使用的是https连接
  • 私有镜像库没有配置https的时候,默认返回的是http信息

二者不一致。

  1. 为镜像库配置https,并使用配置了https的地址去连接docker镜像库
  2. 客户端允许http连接
    可以根据冰河团队提供的解决方法进行修改

https://www.cnblogs.com/binghe001/p/12882214.html

可以通过在docker daemon.json中配置insecure-registries,来解决https问题。

文件位置:

  • linux环境中,daemon.json位于: /etc/docker/daemon.json
  • 在mac或者windows中,可以通过ui界面来修改配置:
    docker-registry-insecure-http-01

改完,重启docker daemon 即可。

阿斌

Read more posts by this author.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK