我在nginx中有以下配置
upstream artifactory_lb {
server artifactoryserver.com:8081;
server otherartifactoryserver.com:8081 backup;
}
其他配置
rewrite ^/(v1|v2)/(.*) /api/docker/image-repo/$1/$2;
client_max_body_size 0;
chunked_transfer_encoding on;
location /v1 {
allow all;
proxy_read_timeout 900;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_set_header X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://artifactory_lb;
}
当我尝试推送图像时,我在docker客户端上获得405 - 不允许的错误,而nginx日志显示以下错误
/usr/share/nginx/html/api/docker/image-repo/v1/_ping" failed (2: No such file or directory)
如何配置nginx以便ping正确的repo位置?这是因为上游服务器不包含repo吗?
更新: 进行以下更改后
location /v1 --> location /
proxy_pass http://artifactoryserver.com:8081/artifactory/
此错误消失,但我在docker客户端上收到以下错误
Sending image list
Error: Status 403 trying to push repository ubuntu: "{\"error\": \"Unauthorized updating repository images\"}"
docker守护程序日志显示
POST /v1.21/images/host:port/ubuntu/push?tag=
这是否意味着它正在击中回购并且需要权限来推送图像,或者它是否意味着回购不存在?
答案 0 :(得分:0)
未经授权的错误是由于客户端的docker版本不支持将artifactory配置为的v1 api