[core][sandbox] Support a Docker Hub pull-through mirror - #65745
Conversation
Sandbox image pulls are anonymous Docker Hub pulls, so a fleet of nodes pulling benchmark images concurrently runs straight into Docker Hub's anonymous rate limits and pays WAN latency per node. RAY_SANDBOX_REGISTRY_MIRROR names a registry that mirrors Docker Hub as host[:port][/repo-prefix] — an ECR pull-through cache, an Artifact Registry remote repository, or an in-cluster registry:2 proxy — and Docker Hub pulls are rewritten to it (other registries pass through untouched). Mirrors Docker's own registry-mirrors semantics, minus the fallback: when set, the mirror is authoritative. Signed-off-by: xyuzh <xinyzng@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request introduces support for routing Docker Hub pulls through a configured pull-through mirror using the RAY_SANDBOX_REGISTRY_MIRROR environment variable. It adds the apply_registry_mirror helper function to rewrite registry and repository paths for Docker Hub, updates the image pulling logic to apply this mirror, and includes corresponding unit tests. Feedback suggests handling potential scheme prefixes (like http:// or https://) in the mirror URL to prevent malformed host and prefix partitioning, along with adding a test case to verify this behavior.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit b78668e. Configure here.
|
This looks great to me, some thoughts:
|
b2b8332 to
f4460a2
Compare
Review feedback: in-cluster pull-through proxies (a plain registry:2) speak HTTP, and a scheme-prefixed mirror value previously produced broken https://http://... URLs. An explicit http:// or https:// scheme on RAY_SANDBOX_REGISTRY_MIRROR is now parsed and honored; bare hosts keep the https default. Signed-off-by: xyuzh <xinyzng@gmail.com>
f4460a2 to
d5e82a3
Compare
Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>
Add a Container images section covering how sandbox images are pulled and cached, and a subsection for RAY_SANDBOX_REGISTRY_MIRROR: why a concurrent cluster needs a mirror, the host[:port][/repo-prefix] value with worked examples for ECR pull-through caches, Artifact Registry remote repositories, and an in-cluster registry:2 proxy, plus the three behaviors that surprise: HTTPS by default, no fallback to Docker Hub, and anonymous pulls only. Point the image-pull troubleshooting bullet at it. Signed-off-by: xyuzh <xinyzng@gmail.com>
|
docs updated |
Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>
Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>
Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>
Signed-off-by: Philipp Moritz <pcmoritz@gmail.com>

Why are these changes needed?
Sandbox image pulls are anonymous Docker Hub pulls. A cluster of nodes pulling distinct multi-GB benchmark images concurrently runs straight into Docker Hub's anonymous rate limits and pays WAN latency on every node — during a Terminal-Bench 2.1 evaluation under Harbor, big-image tasks failed in the concurrent sweep but passed in isolation.
RAY_SANDBOX_REGISTRY_MIRRORnames a registry that mirrors Docker Hub, ashost[:port][/repo-prefix]:<acct>.dkr.ecr.<region>.amazonaws.com/dockerhub),registry:2proxy.Docker Hub pulls are rewritten to the mirror (the prefix prepended to the repository, as ECR requires); other registries pass through untouched. This mirrors Docker's own
registry-mirrorssemantics, minus the fallback: when set, the mirror is authoritative, and it uses the same anonymous token flow as any registry.Related issue number
Follow-up to #65570; sibling of #65737 and #65744.
Checks
test_registry_mirror_rewrites_docker_hub_only); runs without gVisor or network.