I am attempting to execute the Cloud Foundry CLI command: cf push and have it pull a docker image from our aws ecr repository. I keep getting this error message:
Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized
I have logged into aws via the aws configure command with an Access Key ID and a Secret Access Key, and I have gotten the ecr login from the 'aws ecr get-login' command.
I am able to pull the image using docker:
docker pull 1234567.dkr.ecr.us-east-1.amazonaws.com/repo/example:17.5.0-SNAPSHOT
So I know I have valid credentials. However, this is the error when attempting the cf push command:
CF_DOCKER_PASSWORD=mypassword cf push example --docker-image 1234567.dkr.ecr.us-east-1.amazonaws.com/repo/example:17.5.0-SNAPSHOT --docker-username myusername
Using docker repository password from environment variable CF_DOCKER_PASSWORD.
....<snip>
Staging process started ...
Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 1
Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 2
Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized Going to retry attempt: 3
Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized
Staging process failed: Exit trace for group:
builder exited with error: failed to fetch metadata from [repo/example] with tag [17.5.0-SNAPSHOT] and insecure registries [] due to unauthorized: access to the requested resource is not authorized
Exit status 2
Staging Failed: Exited with status 2
Destroying container
Successfully destroyed container
...<snip>
I have tried my aws login and password, and I have also tried the Access Key ID and the Secret Access Key. Both return the same error.
Any ideas on how to integrate aws ecr with cf push?