gpt4 book ai didi

nginx - 无法将 docker 镜像推送到神器

转载 作者:行者123 更新时间:2023-12-01 20:24:33 25 4
gpt4 key购买 nike

我将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 配置

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 验证在设置中工作正常。推送图片前需要设置身份验证吗?我还验证了artifactory 服务器正在监听端口2222

更新,

我将以下内容添加到 nginx 配置

  location /v1 {
proxy_pass http://myNginxLb.company.com:8080/artifactory/api/docker/docker-local/v1;
}

有了这个,现在在尝试推送到存储库时会出现 405 - Not allowed 错误

最佳答案

我通过删除位置/v1 配置并更改代理传递以指向上游服务器来修复此问题

关于nginx - 无法将 docker 镜像推送到神器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34316054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com