问题描述
从Artifactory从6.10.4升级到7.4.1之后,我进行了必要的端口更改,并且UI正常运行,但是在尝试通过以下方式使用docker登录时,在人工服务日志中看到以下内容: subdomain method:
请求/ v2 /应该是回购请求,并且与任何回购密钥都不匹配
docker login命令提示进行身份验证,然后返回:
Artifactory在Nginx入口控制器后面的Kubernetes集群中运行,该控制器的入口专门设置为通过与后端相同的后端为https://
卷曲结果如下:
curl -i -L -k http://docker-local.<artifactory-url>.com/v2/
HTTP/1.1 308 Permanent Redirect
Server: Nginx/1.15.9
Date: Mon,21 Sep 2020 00:25:32 GMT
Content-Type: text/html
Content-Length: 171
Connection: keep-alive
Location: https://docker-local.<artifactory-url>.com/v2/
X-JFrog-Override-Base-Url: ://docker-local.\<artifactory-url>.com:80
X-Forwarded-Port: 80
Host: docker-local.artifactory.<artifactory-url>.com
X-Forwarded-For: 10.60.1.1
HTTP/2 401
server: Nginx/1.15.9
date: Mon,21 Sep 2020 00:25:32 GMT
content-type: application/json;charset=ISO-8859-1
content-length: 91
www-authenticate: Basic realm="Artifactory Realm"
x-artifactory-id: ea0c76c54c1ef5de:45761df0:174ad9a6887:-8000
x-artifactory-node-id: artifactory-0
x-jfrog-override-base-url: ://docker-local.<artifactory-url>.com:443
x-forwarded-port: 443
host: docker-local.<artifactory-url>.com
x-forwarded-for: 10.60.x.x
strict-transport-security: max-age=15724800; includeSubDomains
{
"errors" : [ {
"status" : 401,"message" : "Authentication is required"
} ]
任何帮助将不胜感激!
编辑:作为一种变通办法,我已将“存储库路径”作为Docker访问方法启用,该方法工作正常-仍不确定子域出问题的地方。
解决方法
问题是 Artifactory 提供的 nginx 重写规则中的 $repo 变量由于某种原因没有被填充。由于我们在子域方法中只使用了一个注册表,因此我更新了重写规则以提供解决问题的存储库名称。
举例说明:
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
改为:
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/docker-local/$1/$2;