简体   繁体   English

带有 Amazon ECR Docker 映像的 AWS Elastic Beanstalk

[英]AWS Elastic Beanstalk with Amazon ECR Docker image

I'm new to AWS and I'm trying to deploy a multicontainer Docker application to Elastic Beanstalk.我是 AWS 的新手,正在尝试将多容器 Docker 应用程序部署到 Elastic Beanstalk。 My Dockerrun.aws.json file is very simple, and it's the only thing that's uploaded to EB:我的 Dockerrun.aws.json 文件非常简单,它是唯一上传到 EB 的内容:

{
  "AWSEBDockerrunVersion": 2,
  "containerDefinitions": [
    {
      "name": "mycontainer",
      "image": "somethingsomething.eu-central-1.amazonaws.com/myimage",
      "essential": true,
      "memory": 128
    }
  ]
}

In http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html it says that when using a Docker image uploaded to Amazon ECR:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html 中,它说在使用上传到 Amazon ECR 的 Docker 映像时:

You do, however, need to provide your instances with permission to access the images in your Amazon ECR repository by adding permissions to your environment's instance profile.但是,您确实需要通过向环境的实例配置文件添加权限来为您的实例提供访问 Amazon ECR 存储库中的图像的权限。 You can attach the AmazonEC2ContainerRegistryReadOnly managed policy to the instance profile to provide read-only access to all Amazon ECR repositories in your account您可以将 AmazonEC2ContainerRegistryReadOnly 托管策略附加到实例配置文件,以提供对您账户中所有 Amazon ECR 存储库的只读访问权限

When deploying the application, it raises the following error:部署应用程序时,它会引发以下错误:

ECS task stopped due to: Essential container in task exited. ECS 任务因以下原因停止:任务中的基本容器已退出。 (myimage: CannotPullContainerError: AccessDeniedException: User: arn:aws:sts::xxx:assumed-role/aws-elasticbeanstalk-ec2-role/i-xyz is not authorized to perform: ecr:GetAuthorizationToken on resource: * status code: 400, request id: 4143c35d-) (我的图像:CannotPullContainerError:AccessDeniedException:用户:arn:aws:sts::xxx:assumed-role/aws-elasticbeanstalk-ec2-role/i-xyz 未被授权执行:资源上的 ecr:GetAuthorizationToken:* 状态代码:400 , 请求 id: 4143c35d-)

I added the AWSElasticBeanstalkReadOnlyAccess to the aws-elasticbeanstalk-ec2-role, but it doesn't change anything...我将 AWSElasticBeanstalkReadOnlyAccess 添加到 aws-elasticbeanstalk-ec2-role,但它没有改变任何东西......

Help?!帮助?!

I'm not sure where it's written, but I needed to actually add the AmazonEC2ContainerRegistryReadOnly policy to aws-elasticbeanstalk-ec2-role.我不确定它写在哪里,但我需要实际将 AmazonEC2ContainerRegistryReadOnly 策略添加到 aws-elasticbeanstalk-ec2-role。 AmazonEC2ContainerRegistryReadOnly contains the GetAuthorizationToken action. AmazonEC2ContainerRegistryReadOnly 包含 GetAuthorizationToken 操作。

per https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html#iam-instanceprofile-addperms根据https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html#iam-instanceprofile-addperms

  1. open https://console.aws.amazon.com/iam/home#roles打开https://console.aws.amazon.com/iam/home#roles

  2. Choose aws-elasticbeanstalk-ec2-role选择aws-elasticbeanstalk-ec2-role

  3. On the Permissions tab, choose Attach policies.在权限选项卡上,选择附加策略。

  4. select AmazonEC2ContainerRegistryReadOnly选择AmazonEC2ContainerRegistryReadOnly

  5. Choose Attach policy选择附加策略

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自 ECR 的 AWS Elastic Beanstalk Docker 错误“Dockerrun.aws.json 中未指定 Docker 映像” - AWS Elastic Beanstalk Docker From ECR Error "No Docker image specified in Dockerrun.aws.json" 将 Docker 镜像部署到 AWS elastic beanstalk - Deploying Docker image to AWS elastic beanstalk AWS Elastic Beanstalk - /root/.docker/config.json 在使用 ECR 时未使用新凭证更新 - AWS Elastic Beanstalk - /root/.docker/config.json not updated with new credentials when ECR has been used 使用 Amazon CloudWatch 的 Elastic Beanstalk Docker - Elastic Beanstalk Docker with Amazon CloudWatch AWS Elastic Beanstalk上的Docker中的Docker - Docker in docker on AWS Elastic Beanstalk 如何将 python docker 映像部署到 AWS Elastic beanstalk? - How to deploy a python docker image to AWS Elastic beanstalk? 从私有Docker存储库将映像部署到AWS Elastic Beanstalk - Deploy image to AWS Elastic Beanstalk from private Docker repo AWS Elastic Beanstalk部署具有简单SpringBoot Eureka映像故障的Docker - AWS Elastic Beanstalk deploying Docker with simple SpringBoot Eureka image failure 亚马逊AWS Docker注册表的ECR令牌错误 - ecr token error for amazon aws docker registry 在Amazon Elastic Beanstalk上使用Docker部署Django - Deploying Django with Docker on Amazon Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM