Multi-architecture container images consist of two main parts: layers and a manifest. Each container image has one or more layers of file system content. The manifest specifies the groups of layers that make up the image as well as its runtime characteristics, either ARM64 and X86_64.
This allows you to have the same repository that supports multiple architectures, and the container runtime does the work of selecting which image layers to pull based on the system architecture, including ARM64.
export ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text)
export AWS_REGION=us-east-1
export ECR_URL=$ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $ECR_URL
docker build --tag $ECR_URL/mywebapp:arm64 .
docker push $ECR_URL/mywebapp:arm64
docker manifest create $ECR_URL/mywebapp:latest --amend $ECR_URL/mywebapp:arm64 $ECR_URL/mywebapp:amd64
docker manifest push $ECR_URL/mywebapp:latest
docker manifest inspect $ECR_URL/mywebapp:latest
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx build -f buildx.Dockerfile --platform "linux/amd64,linux/arm64" -t $ECR_URL/mywebapp:buildx --push .
docker manifest inspect $ECR_URL/mywebapp:buildx
aws cloudformation create-stack --stack-name ecs-task-demo --template-body file://demo-env.yaml --capabilities CAPABILITY_NAMED_IAM
./stress-amd.sh
./stress-arm.sh