微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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配置并将代理传递更改为指向上游服务器来解决此问题

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐