系统相关
首页 > 系统相关> > nginx – 无法将泊坞窗图像推送到神器

nginx – 无法将泊坞窗图像推送到神器

作者:互联网

我将artifactory设置为docker注册表,并尝试将图像推送到它

docker push nginxLoadBalancer.mycompany.com/repo_name:image_name

这失败,出现以下错误

The push refers to a repository [ nginxLoadBalancer.mycompany.com/repo_name] (len: 1)
unable to ping registry endpoint https://nginxLoadBalancer.mycompany.com/v0/
v2 ping attempt failed with error: Get https://nginxLoadBalancer.mycompany.com/v2/: Bad Request
 v1 ping attempt failed with error: Get https://nginxLoadBalancer.mycompany.com/v1/_ping: Bad Request

这是我的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;
            }
        }

nginx错误日志中没有错误.可能有什么问题?
 我确认SSL验证在设置时运行良好.在推送图像之前是否需要设置身份验证?
我还验证了神器服务器正在侦听端口2222

更新,

我在nginx配置中添加了以下内容

  location /v1 {
            proxy_pass http://myNginxLb.company.com:8080/artifactory/api/docker/docker-local/v1;
        }

有了它,它现在在尝试推送到存储库时提供405 – 不允许的错误

解决方法:

我通过删除location / v1配置并将代理传递更改为指向上游服务器来解决此问题

标签:nginx,docker,repository,artifactory
来源: https://codeday.me/bug/20190702/1356566.html