diff --git a/Issue/issue.en.md b/Issue/issue.en.md index 62dce8b..38b3f03 100644 --- a/Issue/issue.en.md +++ b/Issue/issue.en.md @@ -31,7 +31,7 @@ #### 3. How long does the registry image cache last, and how to adjust it? **Known Issue:** The default cache time is 168 hours, which is 7 days. Adjust the cache time by modifying the ttl in the proxy configuration section of the configuration file -#### 4. Regarding the scheme for pulling images from the `Hub` public space without adding `library` when using an image acceleration +#### 4. Regarding the solution for pulling images from the 'Hub' public namespace with or without adding the 'library' prefix when using a mirror registry for acceleration. - This scheme was provided by a senior member in the communication group and has been implemented and tested through Nginx. ```shell @@ -45,12 +45,21 @@ http { listen 80; server_name hub.your_domain.com; - location ^~ / { - if ($request_uri ~ ^/v2/([^/]+)/(manifests|blobs)/(.*)$) { - # 重写路径并添加 library/ - rewrite ^/v2/(.*)$ /v2/library/$1 break; - } + # 在docker hub的配置中添加下面的location规则 + location ~ ^/v2/([^/]+)/(manifests|blobs)/(.*)$ { + rewrite ^/v2/(.*)$ /v2/library/$1 break; + proxy_pass http://127.0.0.1:51000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + } + location / { proxy_pass http://127.0.0.1:51000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -67,4 +76,4 @@ http { #### 5. An error occurs when pulling an image `tls: failed to verify certificate: x509: certificate signed by unknown authority` -**Known Issue:** Certificate issue. Indicates that the certificate was issued by an unknown or untrusted certificate Authority (CA). \ No newline at end of file +**Known Issue:** Certificate issue. Indicates that the certificate was issued by an unknown or untrusted certificate Authority (CA). diff --git a/Issue/issue.md b/Issue/issue.md index 1b84571..5c7f782 100644 --- a/Issue/issue.md +++ b/Issue/issue.md @@ -33,7 +33,7 @@ - - 要是调度程序正常清理旧数据,需要配置中将 `delete` 开启(本项目默认已开启) -#### 4、使用镜像加速拉取`hub`公共空间下的镜像时如何不添加`library` +#### 4、使用镜像加速拉取`hub`公共空间下的镜像时兼容不添加`library`的情况 - 此方案来自交流群里大佬提供,通过nginx实现并实测 ```shell @@ -50,12 +50,20 @@ http { server_name hub.your_domain.com; # 在docker hub的配置中添加下面的location规则 - location ^~ / { - if ($request_uri ~ ^/v2/([^/]+)/(manifests|blobs)/(.*)$) { - # 重写路径并添加 library/ - rewrite ^/v2/(.*)$ /v2/library/$1 break; - } + location ~ ^/v2/([^/]+)/(manifests|blobs)/(.*)$ { + rewrite ^/v2/(.*)$ /v2/library/$1 break; + proxy_pass http://127.0.0.1:51000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + } + location / { proxy_pass http://127.0.0.1:51000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -139,4 +147,4 @@ proxy: username: password: ttl: 168h - ``` \ No newline at end of file + ```