Setting up AWS ECR Credential Helper in Windows

You’re probably here because the AWS documentation for Windows on the AWS ECR Credential Helper isn’t very helpful when it comes to Windows. Fortunately the installation is straightforward:

Step 1

Download the latest windows-amd64 binary from the GitHub repository: Releases · awslabs/amazon-ecr-credential-helper (github.com)

Step 2

Put the binary into your path, if you don’t already have a folder set up for this, create a folder ‘bin’ in the root of your C drive, and put the file there. To add to your path, right-click on the start menu and select ‘System’. Scroll down and select ‘Advanced System Settings’. Click on ‘Environment Variables’, in the bottom ‘System variables’ section find the ‘Path’:

Environment variables screenshot

Click on ‘Edit’, then ‘New’ and add C:\bin

Environment variables screenshot

Step 3

Go to your user directory (%userprofile%) and then into the .docker directory. For example mine is:

C:\Users\dancl\.docker

Open the .config.json file in a text editor. The JSON is probably minified, in which case it’s easier if you format the file in an editor. An easily accessible editor can be found at: https://jsoneditoronline.org/ Now add a ‘credHelpers’ section and enter your AWS values as required:

{
  "auths": {},
  "credsStore": "desktop",
  "credHelpers": {
    "public.ecr.aws": "ecr-login",
    "<account id>.dkr.ecr.<region>.amazonaws.com": "ecr-login"
  },
  "currentContext": "desktop-linux"
}

Using the credHelpers section, we can support multiple different AWS accounts and regions as required.

Done

You might need to logout or even reboot for the credentials helper to fully activate. Once working, you should be able to pull images from your ECR registries just as easily as the public ones.