docker-proxy: Deploy a proxy/cache for Docker Hub

Docker Hub's rate limits are so low now that they've started to affect
my home lab.  Deploying a caching proxy and directing all pull requests
through it should prevent exceeding the limit.  It will also help
prevent containers from starting if access to the Internet is down, as
long as their images have been cached recently.
This commit is contained in:
2025-07-08 11:30:03 -05:00
parent 6d1442faf0
commit f8f3dd5f83
7 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# vim: set ft=nginx.conf :
proxy_cache_path /var/cache/nginx/docker levels=1:2 keys_zone=docker_cache:100m max_size=10g inactive=60m use_temp_path=off;

View File

@@ -0,0 +1,17 @@
# vim: set ft=nginx.conf :
location /v2/ {
proxy_pass https://registry-1.docker.io;
proxy_set_header Host registry-1.docker.io;
proxy_ssl_server_name on;
proxy_cache docker_cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 10m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504 http_429;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
proxy_http_version 1.1;
proxy_set_header Connection "";
}