You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* implement manifest caching; refactor config with includes, and generate from ENVs in entrypoint.sh
- disabled by default; enable with -e ENABLE_MANIFEST_CACHE=true
- default times and regexes are a wild guess, make sure to tune for your use case.
- add manifest caching/anti-ratelimit usage note to README
- add -e ENABLE_MANIFEST_CACHE=true to examples, some wording changes
- add -e ENABLE_MANIFEST_CACHE=true to one the steps in test workflow.
The main symptom is `Error response from daemon: toomanyrequests: Too Many Requests. Please see https://docs.docker.com/docker-hub/download-rate-limit/` during pulls.
19
+
Many unknowing Kubernetes clusters will hit the limit, and struggle to configure `imagePullSecrets` and `imagePullPolicy`.
20
+
21
+
Since version `0.6.0`, this proxy can be configured with the env var `ENABLE_MANIFEST_CACHE=true` which provides
22
+
configurable caching of the manifest requests that DockerHub throttles. You can then fine-tune other parameters to your needs.
23
+
Together with the possibility to centrally inject authentication (since 0.3x), this is probably one of the best ways to bring relief to your distressed cluster, while at the same time saving lots of bandwidth and time.
24
+
25
+
Note: enabling manifest caching, in its default config, effectively makes some tags **immutable**. Use with care. The configuration ENVs are explained in the [Dockerfile](./Dockerfile), relevant parts included below.
26
+
27
+
```dockerfile
28
+
# Manifest caching tiers. Disabled by default, to mimick 0.4/0.5 behaviour.
29
+
# Setting it to true enables the processing of the ENVs below.
30
+
# Once enabled, it is valid for all registries, not only DockerHub.
31
+
# The envs *_REGEX represent a regex fragment, check entrypoint.sh to understand how they're used (nginx ~ location, PCRE syntax).
32
+
ENV ENABLE_MANIFEST_CACHE="false"
33
+
34
+
# 'Primary' tier defaults to 10m cache for frequently used/abused tags.
35
+
# - People publishing to production via :latest (argh) will want to include that in the regex
36
+
# - Heavy pullers who are being ratelimited but don't mind getting outdated manifests should (also) increase the cache time here
# The default cache duration for manifests that don't match either the primary or secondary tiers above.
47
+
# In the default config, :latest and other frequently-used tags will get this value.
48
+
ENV MANIFEST_CACHE_DEFAULT_TIME="1h"
49
+
```
50
+
9
51
10
52
## What?
11
53
@@ -14,7 +56,7 @@ Essentially, it's a [man in the middle](https://en.wikipedia.org/wiki/Man-in-the
14
56
The main feature is Docker layer/image caching, including layers served from S3, Google Storage, etc.
15
57
16
58
As a bonus it allows for centralized management of Docker registry credentials, which can in itself be the main feature, eg in Kubernetes environments.
17
-
59
+
18
60
You configure the Docker clients (_err... Kubernetes Nodes?_) once, and then all configuration is done on the proxy --
19
61
for this to work it requires inserting a root CA certificate into system trusted root certs.
20
62
@@ -37,6 +79,7 @@ for this to work it requires inserting a root CA certificate into system trusted
37
79
- Map volume `/docker_mirror_cache` for up to `CACHE_MAX_SIZE` (32gb by default) of cached images across all cached registries
38
80
- Map volume `/ca`, the proxy will store the CA certificate here across restarts. **Important** this is security sensitive.
39
81
- Env `CACHE_MAX_SIZE` (default `32g`): set the max size to be used for caching local Docker image layers. Use [Nginx sizes](http://nginx.org/en/docs/syntax.html).
82
+
- Env `ENABLE_MANIFEST_CACHE`, see the section on pull rate limiting.
40
83
- Env `REGISTRIES`: space separated list of registries to cache; no need to include DockerHub, its already done internally.
41
84
- Env `AUTH_REGISTRIES`: space separated list of `hostname:username:password` authentication info.
42
85
-`hostname`s listed here should be listed in the REGISTRIES environment as well, so they can be intercepted.
@@ -46,7 +89,7 @@ for this to work it requires inserting a root CA certificate into system trusted
46
89
### Simple (no auth, all cache)
47
90
```bash
48
91
docker run --rm --name docker_registry_proxy -it \
0 commit comments