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,38 @@
- name: ensure nginx is allowed to proxy
seboolean:
name: httpd_can_network_connect
state: true
persistent: true
tags:
- selinux
- name: ensure nginx docker proxy cache directory exists
file:
path: /var/cache/nginx/docker
owner: nginx
group: nginx
mode: u=rwx,go=
state: directory
tags:
- datadir
- name: ensure nginx docker proxy cache path is configured
copy:
src: dockerhub-proxy-cache.conf
dest: /etc/nginx/conf.d/
notify:
- reload nginx
tags:
- nginx-config
- name: ensure nginx is configured to proxy for docker hub
copy:
src: dockerhub-proxy.conf
dest: /etc/nginx/default.d/dockerhub-proxy.conf
owner: root
group: root
mode: u=rw,go=r
notify:
- reload nginx
tags:
- nginx-config