Nginx 状态405-docker-artifactory

Nginx 状态405-docker-artifactory,nginx,docker,artifactory,Nginx,Docker,Artifactory,将图像推送到docker artifactory时出现以下错误: v1: Error: Status 405 trying to push repository abc-docker-local: "{\n \"errors\" : [ {\n \"status\" : 405,\n \"message\" : \"Method Not Allowed\"\n } ]\n}" 我使用nginx。我的配置文件如下所示: server_name localserver; rewri

将图像推送到docker artifactory时出现以下错误:
v1

Error: Status 405 trying to push repository abc-docker-local: "{\n  \"errors\" : [ {\n    \"status\" : 405,\n    \"message\" : \"Method Not Allowed\"\n  } ]\n}"
我使用nginx。我的配置文件如下所示:

server_name localserver;
rewrite ^  remoteserver/artifactory/api/docker/abc-docker-local/v1 redirect;
if ($http_x_forwarded_proto = '') {
    set $http_x_forwarded_proto  $scheme;
}

location / {
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path ~*^/.* /;
        proxy_pass          http://remoteserver:9081/artifactory/api/docker/abc-docker-local/v1;
        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;
}
在Artifactory中,我将repo设置为
v1
。我还使用
v2
进行了测试,但没有返回终点。v2的确切错误为:

Index response didn't contain any endpoints

提前感谢

如果结果为空,您一定没有插入所有必需的配置-下面是我的沙盒中的一个示例:

无论如何,这是Artifactory生成的配置,我使用它来为安装在远程Ubuntu机器上的Docker 1.10(但也适用于Docker 1.8和1.9)工作,而我的Artifactory沙盒是我的机器

请注意我的证书位置,它不是常见的
(certs\myCert.cert)
,因此请将其更改为SSL证书所在的位置,并且我分别为
V1
V2
使用端口
4441
4442

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    ## add ssl entries when https has been set in config
    ssl_certificate      certs\myCert.cert;
    ssl_certificate_key  certs\myCert.cert;
    ssl_session_cache shared:SSL:1m;
    ssl_prefer_server_ciphers   on;
    ## server configuration
    server {
        listen 443 ssl;
        listen 9091 ;

        server_name localhost;
        if ($http_x_forwarded_proto = '') {
            set $http_x_forwarded_proto  $scheme;
        }
        ## Application specific logs
        ## access_log /var/log/nginx/localhost-access.log timing;
        ## error_log /var/log/nginx/localhost-error.log;
        rewrite ^/$ /artifactory/webapp/ redirect;
        rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
        location /artifactory/ {
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path ~*^/.* /;
        proxy_pass         http://localhost:8080/artifactory/;
        proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
        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;
        }
    }

    ## server configuration
    server {
        listen 4441 ssl;


        server_name localhost;
        if ($http_x_forwarded_proto = '') {
            set $http_x_forwarded_proto  $scheme;
        }
        ## Application specific logs
        ## access_log /var/log/nginx/localhost-access.log timing;
        ## error_log /var/log/nginx/localhost-error.log;
        rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/docker-local-v1/$1/$2;
        client_max_body_size 0;
        chunked_transfer_encoding on;
        location /artifactory/ {
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path ~*^/.* /;
        proxy_pass         http://localhost:8080/artifactory/;
        proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
        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;
        }
    }

    ## server configuration
    server {
        listen 4442 ssl;


        server_name localhost;
        if ($http_x_forwarded_proto = '') {
            set $http_x_forwarded_proto  $scheme;
        }
        ## Application specific logs
        ## access_log /var/log/nginx/localhost-access.log timing;
        ## error_log /var/log/nginx/localhost-error.log;
        rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/docker-local-v2/$1/$2;
        client_max_body_size 0;
        chunked_transfer_encoding on;
        location /artifactory/ {
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path ~*^/.* /;
        proxy_pass         http://localhost:8080/artifactory/;
        proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
        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;
        }
    }
}

您可以指定您正在使用的Artifactory和docker客户端版本吗?docker版本客户端:版本:1.8.2-el7 API版本:1.20包版本:docker-1.8.2-10.el7.x8664GO版本:go1.4.2内置:OS/Arch:linux/amd64服务器:版本:1.8.2-el7 API版本:1.20包版本:Go版本:go1.4.2build:OS/Arch:linux/amd64都设置为使用api v2 Artifactory前端显示:您正在运行Artifactory版本4.2.2,谢谢!在这两个版本的最后几个版本中,api有很多变化-你能尝试docker 1.10和Artifactory 4.7吗?我在设置Artifactory 4.2.2方面付出了很多努力,你知道docker使用Artifactory 4.2.2的版本是什么吗?(如果有的话)Docker 1.8应该可以工作-在我看来,你很可能对你的nginx配置有问题。。。升级到最新的Artifactory不会给您带来任何特别的问题(或风险),但您将获得该功能并省去所有的麻烦。那么您的Artifactory和nginx在同一台机器上吗?相比之下,我在一台机器上安装了nginx和docker,在另一台机器上安装了artifactory。我将设置更改为:内部端口8081,外部端口8443,docker注册表绑定到端口80,API为v2(设置页面中未显示v1),我收到了以下错误:************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************“错误:状态400尝试推送存储库tomcat:{\n”“错误”“:[{\n”“状态”“:400、\n”“消息”“:\“不支持的docker v1存储库请求”“已删除”“。\n}]\n}”***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************。artifactory在另一个vm中更新到docker 1.9.1后,我得到了以下响应:“未知:不允许使用方法”完整版本是docker-1.9.1-25.el7.x86@64,没有日志(启用了特定的调试条目)。如果您正确使用了我的模板,恐怕很难判断。我建议你联系我support@jfrog.com,对我来说,似乎是你的配置有问题。我从support@jfrog.com问题是我使用了docker客户端自动重定向到https的端口80,因为我没有安全证书,所以失败了。我换了港口,干得很卖力。