docker通过代理上传https协议的私服地址报错unknown blob
一、环境说明
1.Docker
[root@server58 ~]# docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:21:36 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:25:25 2018
OS/Arch: linux/amd64
Experimental: false
2.Harbor
- 版本:4.0
- 端口:8088
3.nginx
- 域名:hub.kingboyworld.com
- 通过nginx做为代理,配置ssl证书,将https://hub.kingboyworld.com代理到http://localhost:8088。
- 同时配置http://hub.kingboyworld.com重定向到https://hub.kingboyworld.com
nginx配置文件
server {
listen 80;
server_name hub.kingboyworld.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name hub.kingboyworld.com;
ssl on;
ssl_certificate ssl/kingboyworld.com_bundle.crt;
ssl_certificate_key ssl/kingboyworld.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
access_log logs/hub.kingboyworld.com.access.log;
error_log logs/hub.kingboyworld.com.error.log;
location / {
proxy_pass http://localhost:8088;
proxy_set_header HOST $HOST;#向tomcat转发信息头数据
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
client_max_body_size 1G;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
proxy_buffering off;
tcp_nodelay on;
chunked_transfer_encoding on;
}
}
二、报错信息
The push refers to repository [hub.kingboyworld.com/town-test/config]
b148c16cffe6: Pushing [==================================================>] 25.2MB/25.2MB
148268bf14be: Layer already exists
6a47dae912f7: Layer already exists
00439e7d6354: Layer already exists
a1a8b7f7efac: Layer already exists
341d865c1c22: Layer already exists
61c06e07759a: Layer already exists
bcbe43405751: Layer already exists
e1df5dc88d2c: Layer already exists
unknown blob
三、原因查找
在nginx的配置文件中多加了一行,
proxy_set_header HOST $HOST;#向tomcat转发信息头数据
把这一行注释掉即可。
四、原因分析(不一定对)
HOST会把当前访问的host带到harbor启动nginx镜像,导致了这个问题。