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
This feature might change without preserving backwards compatibility.
125
+
126
+
Trivy supports mirrors for [remote container images](../target/container_image.md#container-registry) and [databases](./db.md).
127
+
128
+
To configure them, add a list of mirrors along with the host to the [trivy config file](../references/configuration/config-file.md#registry-options).
129
+
130
+
!!! note
131
+
Use the `index.docker.io` host for images from `Docker Hub`, even if you don't use that prefix.
132
+
133
+
Example for `index.docker.io`:
134
+
```yaml
135
+
registry:
136
+
mirrors:
137
+
index.docker.io:
138
+
- mirror.gcr.io
139
+
```
140
+
141
+
### Registry check procedure
142
+
Trivy uses the following registry order to get the image:
143
+
144
+
- mirrors in the same order as they are specified in the configuration file
145
+
- source registry
146
+
147
+
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).
148
+
149
+
Example:
150
+
```yaml
151
+
registry:
152
+
mirrors:
153
+
index.docker.io:
154
+
- mirror.with.bad.auth // We don't have credentials for this registry
155
+
- mirror.without.image // Registry doesn't have this image
156
+
```
157
+
158
+
When we want to get the image `alpine` with the settings above. The logic will be as follows:
159
+
160
+
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.
161
+
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).
162
+
3. Get the image from `index.docker.io` (the original registry).
0 commit comments