本文主要解释在工作中使用docker 登录自定义nexus3 仓库,报错解决
Error response from daemon: login attempt to https://hub.itusy.co/v2/ failed with status: 404 Not Found
环境说明:
nexus3 :使用Docker 拉取镜像,自定义Docker registry HTTP端口号:10000
nginx:并未使用Docker 方式部署,而是直接编译安装在本机,
问题说明:
上属问题并非是nexus3 报出,因为经测试如果配置/etc/docker/daeman.json 文件
使用HTTP 格式直接连接10000端口,可以直接登录。但是经过Nginx 反向之后将不可以登录成功,报错 404
解决方式:
Nginx 配置如下:
server {
server_name nexus3.itusy.co;
listen 80;
access_log /home/logs/nginx/www_logs/nexus3_access.log main;
error_log /home/logs/nginx/error.log;
vhost_traffic_status_filter_by_set_key $filter_user_agent agent::$server_name;
vhost_traffic_status_filter_by_set_key $geoip2_data_country_code country::*;
vhost_traffic_status_filter_by_set_key $geoip2_city_name city::*;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Real-IP;
real_ip_recursive on;
location / {
if ($http_user_agent ~ docker ) {
proxy_pass http://127.0.0.1:10000;
}
proxy_pass http://127.0.0.1:8081;
include conf.d/proxy.conf;
}
}
备注:由于我使用CDN,所以回源是使用80,但是真实域名是使用HTTPS 格式;
Rancher v2 配置私有仓库:
- 配置
- 拉取镜像部署服务:
以上信息已配置完成