Skip to content

Commit

Permalink
docs: add order and example for mirrors
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jan 17, 2025
1 parent d7a1b7d commit d082591
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/docs/configuration/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,26 @@ registry:
mirrors:
index.docker.io:
- mirror.gcr.io
```
```
### Registry check procedure
Trivy uses the following registry order to get the image:
- mirrors in the same order as they are specified in the configuration file
- source registry
In cases where we can't get the image from the mirror registry (e.g. when authentication fails, image doesn't exist, etc.) - Trivy will check other mirrors (or the source registry if all mirrors have already been checked).
Example:
```yaml
registry:
mirrors:
index.docker.io:
- mirror.with.bad.auth // We don't have credentials for this registry
- mirror.without.image // Registry doesn't have this image
```
When we want to get the image `alpine` with the settings above. The logic will be as follows:
1. Try to get the image from `mirror.with.bad.auth/library/alpine`, but we get an error because there are no credentials for this registry.
2. Try to get the image from `mirror.without.image/library/alpine`, but we get an error because this registry doesn't have this image (but most likely it will be an error about authorization).
3. Get the image from `index.docker.io` (the original registry).

0 comments on commit d082591

Please sign in to comment.