开发者社区> 问答> 正文

Docker 本地镜像仓库Harbor推送上传报错getsockopt: con?400报错

[root@rancher-agent ~]# docker push 192.168.0.190:9090/spring_cloud/eurekaserver:v1.0.0
The push refers to a repository [192.168.0.190:9090/spring_cloud/eurekaserver]
Put http://192.168.0.190:9090/v1/repositories/spring_cloud/eurekaserver/: dial tcp 192.168.0.190:9090: getsockopt: connection refused
[root@rancher-agent ~]# 

环境:

Harbor版本是V1.2.2

Harbor服务器登录地址是192.168.0.190 ,端口默认80

Harbor服务器Centos7.5 系统已经关闭防火墙

推送命令是

docker tag SOURCE_IMAGE[:TAG] 192.168.0.190:9090/spring_cloud/IMAGE[:TAG]
docker push 192.168.0.190:9090/spring_cloud/IMAGE[:TAG]

docker 版本

[root@rancher-agent ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      8633870/1.13.1
 Built:           Fri Sep 28 19:45:08 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      8633870/1.13.1
 Built:           Fri Sep 28 19:45:08 2018
 OS/Arch:         linux/amd64
 Experimental:    false
[root@rancher-agent ~]# 

操作系统版本

[root@rancher-agent ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core) 
[root@rancher-agent ~]# 

本机IP是192.168.0.189

[root@rancher-agent ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:31:b8:81 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.189/24 brd 192.168.0.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::653b:6d78:6f49:36ce/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
    inet6 fe80::6082:90d5:bfd:516b/64 scope link tentative noprefixroute dadfailed 
       valid_lft forever preferred_lft forever
    inet6 fe80::8c17:3cfb:9e39:f0cc/64 scope link tentative noprefixroute dadfailed 
       valid_lft forever preferred_lft forever

 

根据网上查询资料docker 1.13.1只要修改daemon.json文件

Create or modify /etc/docker/daemon.json

{ "insecure-registries":["192.168.0.190"] }
Restart docker daemon

   systemctl restart docker.service

根据上面已经配置了docker daemon.json文件

[root@rancher-agent ~]# vim /etc/docker/daemon.json

{
"registry-mirrors": ["https://fy707np5.mirror.aliyuncs.com"],
 "insecure-registries":["192.168.0.190:9090"]
}

 

[root@rancher-agent ~]# docker push 192.168.0.190:9090/spring_cloud/eurekaserver:v1.0.0
The push refers to a repository [192.168.0.190:9090/spring_cloud/eurekaserver]
Get https://192.168.0.190:9090/v1/_ping: dial tcp 192.168.0.190:9090: getsockopt: connection refused

加"insecure-registries":["192.168.0.190:9090"错误区别

Put http://192.168.0.190:9090/v1/repositories/spring_cloud/eurekaserver/: dial tcp 192.168.0.190:9090: getsockopt: connection refused
Get https://192.168.0.190:9090/v1/_ping: dial tcp 192.168.0.190:9090: getsockopt: connection refused

 

还是报错。请各位老师指教,不知道哪里配错了。

展开
收起
爱吃鱼的程序员 2020-06-06 10:31:40 1869 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>问题已经解决:正确答案参考</p> 
    
    A:在需要登陆的docker client端修改lib/systemd/system/docker.service文件,在里面修改ExecStart那一行,增加--insecure-registry=192.168.0.6,然后重启docker (systemctl daemon-reload    systemctl restart docker)
    
    B:在harbor服务器端修改 /etc/docker/daemon.json(如果没有这个文件,自己建),修改后,同样运行 (systemctl daemon-reload    systemctl restart docker)我的修改内容如下:
    
    
    --------------------- 
    作者:书房小生 
    来源:CSDN 
    原文:https://blog.csdn.net/zyl290760647/article/details/83752877 
    版权声明:本文为博主原创文章,转载请附上博文链接!

     

                        没配SSL 
                    
    
                            我想HTTP的访问。局域网不想配着HTTPS。能具体说说步骤吗
                        
    
                        <p>成功解决问题,赞一个</p>
    
    2020-06-06 10:31:53
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
5日docker训练营(四).ppt 立即下载
《容器镜像服务企业版 (ACR EE)》 立即下载
Serverless 开启应用上云新方式 立即下载