Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KiranMantha/da6fb40718eb34558c12ad8dff25b519 to your computer and use it in GitHub Desktop.
Save KiranMantha/da6fb40718eb34558c12ad8dff25b519 to your computer and use it in GitHub Desktop.
publish docker image to ecr

Reference link: https://www.youtube.com/watch?v=zs3tyVgiBQQ

Commands

  1. Build Docker Image
  • docker build -t test .
  1. Run container /w image
  • docker run -d --publish 8888:5000 test
  1. Login to ECR
  • aws ecr get-login-password --region <your-aws-region> | docker login --username AWS --password-stdin <your-account-id>.dkr.ecr.<your-region>.amazonaws.com
  1. Tag the version
  • docker tag test:latest <your-ecr-repo-uri>:<image-tag>
  1. Upload
  • docker push <your-ecr-repo-uri>:<image-tag>

Policy Document

//ECR
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "ecr:*",
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor01",
            "Effect": "Allow",
            "Action": "ecr:GetAuthorizationToken",
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor02",
            "Effect": "Allow",
            "Action": "ecr:InitiateLayerUpload",
            "Resource": "*"
        }
    ]
}

ECS arn:aws:iam::aws:policy/AmazonECS_FullAccess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment