'Could not pull docker image from ECR to EC2 Ubuntu on same account

Currently running course https://gitlab.com/nanuchi/techworld-js-docker-demo-app/-/tree/master

Locally + pulling from aws ECR running fine.

I got trouble as soon as i was trying to pull image from ECR to EC2 Ubuntu through docker-compose on same account

asw cli installed, account id key, region --- summited. aws ecr get-login password ----- ok login to EC2 Ubuntu succeeded

as soon as i lunch docker-compose mongo.yaml on EC2 Ubuntu up i got

Pulling my-app (*********0.dkr.ecr.us-east-2.amazonaws.com/my-app1:1.0)... ERROR: Head "https://*********0.dkr.ecr.us-east-2.amazonaws.com/v2/my-app1/manifests/1.0": no basic auth credentials

Could some one tell me what i am doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source