http - nginx 没有那个文件或目录

标签 http nginx docker artifactory

我在nginx中有如下配置

upstream artifactory_lb {
    server artifactoryserver.com:8081;
    server otherartifactoryserver.com:8081 backup;
}

其他配置

rewrite ^/(v1|v2)/(.*) /api/docker/image-repo/$1/$2;
client_max_body_size 0;
chunked_transfer_encoding on;

location /v1 {
    allow all;
    proxy_read_timeout  900;
    proxy_pass_header   Server;
    proxy_cookie_path   ~*^/.* /;
    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;
    proxy_pass          http://artifactory_lb; 
}

当我尝试推送图像时,docker 客户端出现 405 - Not allowed 错误,而 nginx 日志显示以下错误

/usr/share/nginx/html/api/docker/image-repo/v1/_ping" failed (2: No such file or directory)

如何配置 nginx 以便它 ping 正确的 repo 位置?是因为上游服务器没有repo吗?

更新: 进行以下更改后

location /v1 --> location /
proxy_pass http://artifactoryserver.com:8081/artifactory/

此错误消失,但我在 docker 客户端上收到以下错误

Sending image list
Error: Status 403 trying to push repository ubuntu: "{\"error\": \"Unauthorized updating repository images\"}"

docker 守护进程日志显示

POST /v1.21/images/host:port/ubuntu/push?tag=

这是否意味着它正在访问存储库并需要推送图像的权限,或者这是否意味着存储库不存在??

最佳答案

未授权的错误是因为客户端的docker版本不支持artifactory配置的v1 api

关于http - nginx 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34423758/

相关文章:

docker - 我在哪里可以找到 docker 的 nginx(稳定)?

performance - Varnish 和Nginx重定向8080-> 80

http - 我将如何使用 cron 作业发送 HTML GET 请求?

python-3.x - 包装io.BufferedIOBase,使其变为可搜索

python - 在 AWS EC2 实例上使用 nginx 配置 django

python-3.x - Selenium Python : No such file or directory: '/usr/local/bin/chromedriver' but it exists and is added to path

ubuntu - docker 错误 : no space left on device

docker - 如何绕过 Rstudio 上的登录页面?

javascript - 文本/纯文件下载的 Angular http$ 响应失败,出现 SyntaxError : Unexpected number in JSON

python - 使用 python 访问受 token 保护的 API 中的数据