Artifactory主机名称parsing到dockerregistry

我正在试图将一个docker镜像推送到Artifactory中新创build的Docker仓库中。 为此我标记图像如下,

docker tag ubuntu mNginxLb.mycompany.com/artifactory/api/docker/<repo_key> 

然后推送图像,但得到以下错误

 docker push mNginxLb.mycompany.com/artifactory/api/docker/<repo_key>/ubuntu The push refers to a repository [mNginxLb.mycompany.com/artifactory/api/docker/<repo_key>/ubuntu] (len: 1) unable to ping registry endpoint https://mNginxLb.mycompany.com/v0/ v2 ping attempt failed with error: Get https://mNginxLb.mycompany.com/v2/: x509: certificate signed by unknown authority v1 ping attempt failed with error: Get https://mNginxLb.mycompany.com/v1/_ping: x509: certificate signed by unknown authority 

这是证书签名权限问题还是主机名parsing问题? 我检查了其他存储库是否可以正常使用SSL证书,因此我不确定问题是否是证书。 这是我的nginx conf:

 upstream artifactory_lb { server mNginxLb.mycompany.com:8081; server mNginxLb.mycompany.com backup; } log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time'; server { listen 80; listen 443 ssl; ssl_certificate /etc/nginx/ssl/my-certs/myCert.pem; ssl_certificate_key /etc/nginx/ssl/my-certs/myserver.key; client_max_body_size 2048M; location / { proxy_set_header Host $host:$server_port; proxy_pass http://artifactory_lb; proxy_read_timeout 90; } access_log /var/log/nginx/access.log upstreamlog; location /basic_status { stub_status on; allow all; } } # Server configuration server { listen 2222 ssl; server_name mNginxLb.mycompany.com; if ($http_x_forwarded_proto = '') { set $http_x_forwarded_proto $scheme; } rewrite ^/(v1|v2)/(.*) /api/docker/my_local_repo_key/$1/$2; client_max_body_size 0; chunked_transfer_encoding on; location / { proxy_read_timeout 900; proxy_pass_header Server; proxy_cookie_path ~*^/.* /; proxy_pass http://artifactory_lb; 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; } } 

更新:

在通过CA将证书更新为一个之后,这个错误消失了,尽pipe我仍然不能推送图像并且得到一个403禁止的错误。 我使用的命令是

  docker push host:port/The push refers to a repository [host:port/image_name] (len: 1) Sending image list Error: Status 403 trying to push repository ubuntu: "<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.22 - Error report</title><style type=\"text/css\">H1 {f ont-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#5 25D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;c olor:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;backgro und:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><bod y><h1>HTTP Status 403 - </h1><div class=\"line\"></div><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>Access to the speci fied resource has been forbidden.</u></p><hr class=\"line\"><h3>Apache Tomcat/8.0.22</h3></body></html>"image_name 

docker客户端提供以下错误当artifactory日志显示以下

 "GET /v2/ HTTP/1.1" 404 466 "-" "docker/1.9.1 go/go1.4.2 git-commit/a34a1d5 kernel/3.13.0-24-generic os/linux arch/amd64" 172.28.144.202 - - [22/Dec/2015:11:06:00 -0500] "GET /v2/ HTTP/1.1" 404 466 "-" "docker/1.9.1 go/go1.4.2 git-commit/a34a1d5 kernel/3.13.0-24-generic os/linux arch/amd64" "GET /v1/_ping HTTP/1.1" 404 470 "-" "docker/1.9.1 go/go1.4.2 git-commit/a34a1d5 kernel/3.13.0-24-generic ] "PUT /v1/repositories/ubuntu/ HTTP/1.1" 403 449 "-" "docker/1.9.1 go/go1.4.2 git-commit/a34a1d5 kernel/3.13.0-24-generic os/linux arch/amd64" 

Docker将主机名后的所有内容视为存储库名称(可选地包含一个名称空间)和标记。 这意味着你只需要使用你分配的端口(2222)和主机名。 上下文路径将成为存储库名称。

你的情况应该是:

docker tag ubuntu mNginxLb.mycompany.com:2222/ubuntu

docker push mNginxLb.mycompany.com:2222/ubuntu

注意latest标签是隐含的。 另一个例子可能是:

docker tag ubuntu:15.10 mNginxLb.mycompany.com:2222/ubuntu:15.10

问题是我用V1 docker API配置了artifactory,但是试图推送一个支持v2 API的图像