File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ CACHE_MAX_SIZE=${CACHE_MAX_SIZE:-32g}
104
104
# Set to 32gb which should be enough
105
105
echo " proxy_cache_path /docker_mirror_cache levels=1:2 max_size=$CACHE_MAX_SIZE min_free=${CACHE_MIN_FREE:- 1g} inactive=${CACHE_INACTIVE_TIME:- 60d} keys_zone=cache:15m use_temp_path=off manager_threshold=${CACHE_MANAGER_THRESHOLD:- 1000ms} manager_sleep=${CACHE_MANAGER_SLEEP:- 250ms} manager_files=${CACHE_MANAGER_FILES:- 100} loader_files=${CACHE_LOADER_FILES:- 100} loader_threshold=${CACHE_LOADER_THRESHOLD:- 200ms} loader_sleep=${CACHE_MANAGER_SLEEP:- 50ms} ;" > /etc/nginx/conf.d/cache_max_size.conf
106
106
107
+ # Set Docker Registry cache valid time, by default, 60 day ('60d')
108
+ CACHE_VALID_TIME=${CACHE_VALID_TIME:- 60d}
109
+
110
+ # Set default cache valid time for 200 and 205 response.
111
+ sed -i " /# Cache all 200, 206 for 60 days default./a\ proxy_cache_valid 200 206 ${CACHE_VALID_TIME} ;" /etc/nginx/nginx.conf
112
+
107
113
# Manifest caching configuration. We generate config based on the environment vars.
108
114
echo -n " " > /etc/nginx/nginx.manifest.caching.config.conf
109
115
Original file line number Diff line number Diff line change @@ -242,8 +242,7 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
242
242
proxy_cache_lock on;
243
243
proxy_cache_lock_timeout 880s;
244
244
245
- # Cache all 200, 206 for 60 days.
246
- proxy_cache_valid 200 206 60d ;
245
+ # Cache all 200, 206 for 60 days default.
247
246
248
247
# Some extra settings to maximize cache hits and efficiency
249
248
proxy_force_ranges on;
You can’t perform that action at this time.
0 commit comments