''Get-ECRLoginCommand' is not recognized as the name of a cmdlet, function, script file, or operable program
I am trying to download a Docker image from AWS and following the instructions at AWS I'm running:
(Get-ECRLoginCommand).Password | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
However, I'm getting the following error:
Get-ECRLoginCommand : The term 'Get-ECRLoginCommand' is not recognized as the name of a cmdlet, function, script file, or operable program.
How can I fix this error? I assume I need to install the module.
Solution 1:[1]
After some searching, I realised I had omitted installing ECR when installing AWSTools. I had used these 2 commands:
Install-Module -Name AWS.Tools.Installer -Force
Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp
So I installed it with:
Install-AWSToolsModule AWS.Tools.ECR
After that it worked.
Solution 2:[2]
In my case, running this command on the AWS CLI instead of the AWS tool for Windows PowerShell worked.
aws ecr get-login-password --region [your region] | docker login --username AWS --password-stdin [your aws_account_id].dkr.ecr.[your region].amazonaws.com
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sashoalm |
| Solution 2 | mitsu |
