Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client

问题:Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client

无法上传

[root@localhost data]# docker push 192.168.238.10:5000/nginx
Using default tag: latest
The push refers to repository [192.168.238.10:5000/nginx]
Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client
[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest 
The push refers to repository [192.168.238.10:5000/nginx]
Get https://192.168.238.10:5000/v2/: http: server gave HTTP response to HTTPS client


[root@localhost data]# curl -XGET http://192.168.238.10:5000/v2/_catalog
{"repositories":[]}

原因:/etc/docker/daemon.json文件配置有问题

[root@localhost data]# vim /etc/docker/daemon.json 
{
  "insecure-registries":["192.168.238.10:5000"],									#是registries不是registry
  "registry-mirrors": ["https://4xxxxxxx.mirror.aliyuncs.com"]
}
[root@localhost data]# systemctl restart docker.service 

问题:Get http://192.168.238.10:5000/v2/: dial tcp 192.168.238.10:5000: connect: connection refused

[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest 
The push refers to repository [192.168.238.10:5000/nginx]
Get http://192.168.238.10:5000/v2/: dial tcp 192.168.238.10:5000: connect: connection refused

原因:docker里registry端口映射服务关闭了

[root@localhost data]# docker images 
REPOSITORY                  TAG       IMAGE ID       CREATED             SIZE
centos                      os-7      400cf047cbc5   About an hour ago   286MB
192.168.238.10:5000/nginx   latest    f6d0b4767a6c   2 months ago        133MB
nginx                       latest    f6d0b4767a6c   2 months ago        133MB
registry                    latest    678dfa38fcfa   3 months ago        26.2MB
[root@localhost data]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS                          PORTS     NAMES
375179e20662   registry       "/entrypoint.sh /etc…"   40 minutes ago   Exited (2) About a minute ago             hardcore_germain						#端口映射关闭了
70673b43a615   registry       "/entrypoint.sh /bin…"   45 minutes ago   Exited (127) 44 minutes ago               eloquent_hoover
4e0245a200ff   nginx:latest   "/docker-entrypoint.…"   2 hours ago      Exited (137) 50 minutes ago               confident_cohen

解决:开启映射

[root@localhost data]# docker start 375179e20662				#开启映射
375179e20662
[root@localhost data]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS                        PORTS                    NAMES
375179e20662   registry       "/entrypoint.sh /etc…"   41 minutes ago   Up 1 second                   0.0.0.0:5000->5000/tcp   hardcore_germain			###############开启了
70673b43a615   registry       "/entrypoint.sh /bin…"   46 minutes ago   Exited (127) 45 minutes ago                            eloquent_hoover
4e0245a200ff   nginx:latest   "/docker-entrypoint.…"   2 hours ago      Exited (137) 51 minutes ago                            confident_cohen

上传成功了

[root@localhost data]# docker push 192.168.238.10:5000/nginx:latest 
The push refers to repository [192.168.238.10:5000/nginx]
85fcec7ef3ef: Pushed 
3e5288f7a70f: Pushed 
56bc37de0858: Pushed 
1c91bf69a08b: Pushed 
cb42413394c4: Pushed 
latest: digest: sha256:0b159cd1ee1203dad901967ac55eee18c24da84ba3be384690304be93538bea8 size: 1362

  • 10
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值