When trying to use a GCP Artifact Registry repository as a cache for Docker Hub, Docker presents a handful of challenges:
- No authentication is provided.
- The request paths for library images (say
hello-world
) don't match what GCP requires.
This proxy handles both of those by using GCP Application Default Credentials for injecting authentication and rewriting matching paths.
You can either pass the arguments via the command line as flags:
gcp-artifact-registry-docker-proxy --listen localhost:1234 --registry https://us-docker.pkg.dv/example-project/example-repo
Or via environment variables:
PROXY_LISTEN=localhost:1234 PROXY_REGISTRY=https://us-docker.pkg.dv/example-project/example-repo gcp-artifact-registry-docker-proxy
To configure docker daemon with Gcp Artifact Registry Docker Proxy add registry-mirror to /etc/docker/daemon.json (on linux):
{
"registry-mirrors": ["http://localhost:1234/<YOUR GCP PROJECT NAME>/<ARTIFACT REGISTRY NAME>/"],
"insecure-registries": ["localhost:1234"]
}