harbor push 报错

  1. 报错内容

报错内容

harbor是用公司内部的一个Ng进行统一代理,突然无法push镜像到harbor,报错如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
root@pts/2 $ docker push harbor.xx.xxx.com/library/jenkins
The push refers to repository [harbor.xxx.xxx.com/library/jenkins]
0577e068c587: Preparing
b1891bf16fa7: Preparing
37c1d818eb0b: Preparing
d51e4482f53a: Preparing
ceed640cbb93: Preparing
047f9c957a2e: Waiting
1db731634011: Waiting
a0775f499ef1: Waiting
c19390bb619a: Waiting
6ff38243bfb8: Waiting
9fe468dbb76f: Waiting
571ae0d6961a: Waiting
518c9e7eb326: Waiting
c3ebb2aa7787: Waiting
9c2e8b91bfa8: Waiting
c477b6c8ca45: Waiting
fa0c3f992cbd: Waiting
ce6466f43b11: Waiting
719d45669b35: Waiting
3b10514a95be: Waiting
error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
<title>Page not found at /v2/k8s.gcr.io/maven/blobs/uploads/</title>
<meta name=\"robots\" content=\"NONE,NOARCHIVE\">
<style type=\"text/css\">
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font:small sans-serif; background:#eee; color:#000; }
body>div { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 span { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
</style>
</head>
<body>
<div id=\"summary\">
<h1>Page not found <span>(404)</span></h1>
<table class=\"meta\">
<tr>
<th>Request Method:</th>
<td>POST</td>
</tr>
<tr>
<th>Request URL:</th>
<td>http://harbor.xxx.xxx.com/v2/k8s.gcr.io/maven/blobs/uploads/</td>
</tr>
</table>
</div>
<div id=\"info\">
<p>
Using the URLconf defined in <code>jumpserver.urls</code>,
Django tried these URL patterns, in this order:
</p>
<ol>
<li>
[name='index']
</li>
<li>
api/v1/
</li>
<li>
api/v2/
</li>
<li>
api/(?P&lt;app&gt;\\w+)/(?P&lt;version&gt;v\\d)/.*
</li>
<li>
api/health/
[name='health']
</li>
<li>
luna/
[name='luna-view']
</li>
<li>
ws/.*
[name='ws-view']
</li>
<li>
i18n/&lt;str:lang&gt;/
[name='i18n-switch']
</li>
<li>
settings/
</li>
<li>
captcha/
</li>
<li>
users/
</li>
<li>
assets/
</li>
<li>
perms/
</li>
<li>
terminal/
</li>
<li>
ops/
</li>
<li>
audits/
</li>
<li>
orgs/
</li>
<li>
auth/
</li>
<li>
applications/
</li>
<li>
flower/(?P&lt;path&gt;.*)
[name='flower-view']
</li>
<li>
^media\\/(?P&lt;path&gt;.*)$
</li>
<li>
^static\\/(?P&lt;path&gt;.*)$
</li>
<li>
zh-hans/
</li>
<li>
^swagger(?P&lt;format&gt;\\.json|\\.yaml)$
[name='schema-json']
</li>
<li>
docs/
[name='docs']
</li>
<li>
redoc/
[name='redoc']
</li>
<li>
^v2/swagger(?P&lt;format&gt;\\.json|\\.yaml)$
[name='schema-json']
</li>
<li>
docs/v2/
[name='docs']
</li>
<li>
redoc/v2/
[name='redoc']
</li>
</ol>
<p>
The current path, <code>v2/k8s.gcr.io/maven/blobs/uploads/</code>, didn't match any of these.
</p>
</div>
<div id=\"explanation\">
<p>
You're seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</div>
</body>
</html>

上面那个html代码提示明显不是harbor的接口,而是另外一个基础服务的接口,才想起来最近这个基础服务刚刚部署了https,经过抓包发现居然和这个基础服务通信,docker默认使用https进行访问,另外daemon.json的insecure-registries配置了对应的域名只是没有配置端口,因为harbor是通过docker部署的对外暴露的只有80端口,但是感觉逻辑上还是讲不通,在没有部署https服务之前是正常的,说明通过域名是能正确访问到对应服务的,但是当开启了https之后居然没有正确访问到对应的域名,

1
2


1
2
3
4
5
6
7
8
9
10
11
12
cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://xxx.mirror.aliyuncs.com"
],
"insecure-registries": [
"harbor.xx.xxxx.com"
],
"bip":"192.168.160.1/24",
"exec-opts": ["native.cgroupdriver=systemd"],
"graph": "/data/docker"
}

###解决办法

  • 方法一

insecure-registries添加80端口
但是这样一来docker login时需要添加端口,docker tag的时候也要添加上端口

1
"insecure-registries": [ "harbor.xx.xxxx.com:80" ]
  • 方法二: 不用代理,将域名直接指向harbor的80端口

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 jaytp@qq.com

文章标题:harbor push 报错

文章字数:1.1k

本文作者:Aaron

发布时间:2019-12-25, 16:55:24

最后更新:2019-12-25, 21:26:06

原始链接:http://blog.linuxerbulo.com/2019/12/25/harbor-push-%E6%8A%A5%E9%94%99/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏