docker build for ECR
-
1. build
docker build -t nextjs-app .
aws ecr get-login-password --region ap-southeast-1
Then it will come out the password
2. login
docker login -u AWS -p somePassword 123456789012.dkr.ecr.us-east-1.amazonaws.com
3. tag
docker tag nextjs-app:latest 123456789012.dkr.ecr.us-east-1.amazonaws.com/nextjs-app:latest
4. push
docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/nextjs-app:latest
Below example for docker login stdin with aws get password
aws ecr get-login-password --region ap-southeast-1 | docker login -u AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com