簡體   English   中英

狀態 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 生成的配置,它適用於安裝在遠程 Ubuntu 機器上的 Docker 1.10(但也適用於 Docker 1.8 和 1.9),而我的 Artifactory 沙箱是我的機器。

請注意我擁有的不常見的證書位置(certs\\myCert.cert)因此請將其更改為您的 SSL 證書所在的任何位置,並且我分別為V1V2使用端口44414442

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM