-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Description
Problem:
# For blob requests by digest, do cache, and treat redirects.
location ~ ^/v2/(.*)/blobs/sha256:(.*) {
set $docker_proxy_request_type "blob-by-digest";
include "/etc/nginx/nginx.manifest.common.conf";
}
# For manifest requests by digest, do cache, and treat redirects.
# These are some of the requests that DockerHub will throttle.
location ~ ^/v2/(.*)/manifests/sha256:(.*) {
set $docker_proxy_request_type "manifest-by-digest";
include "/etc/nginx/nginx.manifest.common.conf";
}
In these two cases , cache key is URI :(`proxy_cache_key $uri;`) and this treats below 2 blobs as different and consumes extra storage!
1. my.docker.host/v2/someDockerImage1/blobs/sha256:74924e75d64523f42420d9b0617430fa955e49d835e663e6c838f0ed5209c8da
2. my.docker.host/v2/someDockerImage2/blobs/sha256:74924e75d64523f42420d9b0617430fa955e49d835e663e6c838f0ed5209c8da
Solution:
Use SHA as KEY
```
location ~ ^/v2/(.*)/blobs/(.*) {
set $cache_key $2;
proxy_pass https://$host;
proxy_cache cache;
proxy_cache_key $cache_key;
```
hishamanver, mboutet and baby-gnu
Metadata
Metadata
Assignees
Labels
No labels