状态 405 - docker - 神器

Status 405 - 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;
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 生成的配置,它适用于 Docker 1.10(但也适用于 Docker 1.8 和 1.9)安装在远程 Ubuntu 机器,而我的 Artifactory 沙箱是我的机器。

请注意我的证书位置不常见 (certs\myCert.cert) 所以将其更改为您的 SSL 证书所在的位置,并且我正在使用端口 44414442 V1V2 分别为:

#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//;
        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//;
        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;
        }
    }
}