Custom Registry Mirrors
Dagger can be configured to use container registry mirrors for any registry URL. This allows container images that refer to one registry to instead be redirected to a different one.
Create a file named engine.toml
that contains the registry mirror:
debug = true
insecure-entitlements = ["security.insecure"]
[registry."docker.io"]
mirrors = ["mirror.gcr.io"]
This configuration can be repeated for multiple registries and mirrors if needed:
[registry."docker.io"]
mirrors = ["mirror.a.com", "mirror.b.com"]
[registry."some.other.registry.com"]
mirrors = ["mirror.foo.com", "mirror.bar.com"]
Manually start Dagger with the custom engine.toml
:
docker run --rm -v /var/lib/dagger --name customized-dagger-engine --privileged --volume $PWD/engine.toml:/etc/dagger/engine.toml registry.dagger.io/engine:v0.10.2
Execute the following commands to test the configuration:
export _EXPERIMENTAL_DAGGER_RUNNER_HOST=docker-container://customized-dagger-engine
dagger query --progress=plain <<< '{ container { from(address:"hello-world") { stdout } } }'
The specified hello-world
container will now be pulled from the mirror instead of from Docker Hub.