Option to configure proxy cache TTL

Currently when registry is run as proxy it tries to cleanup unused blobs
from its cache after 7 days which is hard-coded. This PR makes that
value configurable.

Co-authored-by: Shiming Zhang <wzshiming@foxmail.com>
Co-authored-by: Manish Tomar <manish.tomar@docker.com>
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
This commit is contained in:
Manish Tomar 2020-08-27 17:07:35 -07:00 committed by Shiming Zhang
parent 0c958010ac
commit 8fe4ca4038
8 changed files with 131 additions and 59 deletions

View file

@ -299,6 +299,7 @@ proxy:
remoteurl: https://registry-1.docker.io
username: [username]
password: [password]
ttl: 168h
compatibility:
schema1:
signingkeyfile: /etc/registry/key.json
@ -1184,6 +1185,7 @@ proxy:
remoteurl: https://registry-1.docker.io
username: [username]
password: [password]
ttl: 168h
```
The `proxy` structure allows a registry to be configured as a pull-through cache
@ -1197,6 +1199,7 @@ is unsupported.
| `remoteurl`| yes | The URL for the repository on Docker Hub. |
| `username` | no | The username registered with Docker Hub which has access to the repository. |
| `password` | no | The password used to authenticate to Docker Hub using the username specified in `username`. |
| `ttl` | no | Expire proxy cache configured in "storage" after this time. Cache 168h(7 days) by default, set to 0 to disable cache expiration, The suffix is one of `ns`, `us`, `ms`, `s`, `m`, or `h`. If you specify a value but omit the suffix, the value is interpreted as a number of nanoseconds. |
To enable pulling private repositories (e.g. `batman/robin`) specify the

View file

@ -91,6 +91,7 @@ proxy:
remoteurl: https://registry-1.docker.io
username: [username]
password: [password]
ttl: 168h
```
> **Warning**: If you specify a username and password, it's very important to