Skip to content

Registry mirror for docker.io does not work #2671

@bh-tt

Description

@bh-tt

What steps did you take and what happened:

I've configured trivy.registry.mirror.docker.io: docker-io,example.com (anonimzed URL) in the trivy-operator-trivy-config configmap and restarted the operator. The operator still does not replace docker.io/ in the scan jobs with docker.io.example.com/.

Additionally, the current mirror configuration does not allow specifying a 'default' mirror for images like library/mariadb. The scan job dutifully attempts to pull from docker.io, but this is not directly accessible to prevent rate limit issues. We updated most images without a registry to include docker.io/ prefix.

What did you expect to happen:
I expected the mirror registry settings to work for all possible registry URLs.
Anything else you would like to add:

I know the cause: https://github.com/google/go-containerregistry/blob/59a4b85930392a30c39462519adc8a2026d47181/pkg/name/registry.go#L136 rewrites docker.io to index.docker.io. The result is that specifying a mirror for docker.io does nothing, since the parsed reference ends up as index.docker.io/library/mariadb.

Environment:

  • Trivy-Operator version (use trivy-operator version):0.27.3
  • Kubernetes version (use kubectl version):1.32.7
  • OS (macOS 10.15, Windows 10, Ubuntu 19.10 etc): linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions