From 14a5a71324f948b3d78fb3ea461b07c9bd109516 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Mon, 23 Dec 2024 01:34:07 +0000 Subject: [PATCH] docs: Add note on using credHelpers for multi-registry authentication Signed-off-by: Arjun Raja Yogidas --- README.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 50fc0abe..291a9b03 100644 --- a/README.md +++ b/README.md @@ -220,22 +220,6 @@ contents of your `~/.docker/config.json` file to be: This configures the Docker daemon to use the credential helper for all Amazon ECR registries. -The Amazon ECR Docker Credential Helper can be used alongside your existing docker login authentication tokens: - -```json -{ - "credsStore": "ecr-login", - "auths": { - "https://index.docker.io/v1/": { - "auth": [docker.io-auth-token] - }, - "registry.gitlab.com": { - "auth": [gitlab-auth-token] - }, - } -} -``` - With Docker 1.13.0 or greater, you can configure Docker to use different credential helpers for different ECR registries. To use this credential helper for a specific ECR registry, create a `credHelpers` section with the URI of your @@ -253,6 +237,26 @@ ECR registry: This is useful if you use `docker` to operate on registries that use different authentication credentials. +If you need to authenticate with multiple registries, including non-ECR registries, you can combine credHelpers with auths. For example: +```json +{ + "credHelpers": { + ".dkr.ecr..amazonaws.com": "ecr-login" + }, + "auths": { + "ghcr.io": { + "auth": [GITHUB_PERSONAL_ACCESS_TOKEN] + }, + "https://index.docker.io/v1/": { + "auth": [docker.io-auth-token] + }, + "registry.gitlab.com": { + "auth": [gitlab-auth-token] + } + } +} +``` + ### AWS credentials The Amazon ECR Docker Credential Helper allows you to use AWS credentials stored in different locations. Standard ones