简体   繁体   English

AWS Elastic Beanstalk 与 AMI2 和 docker-compose.yml

[英]AWS Elastic Beanstalk with AMI2 and docker-compose.yml

I have been trying to make Elastic Beanstalk work with Docker AMI2 image and docker-compose.yml .我一直在尝试使 Elastic Beanstalk 与 Docker AMI2 图像和docker-compose.yml The documentation says it should work out of the box with docker-compose.yml file.文档说它应该与docker-compose.yml文件一起使用。 I use ECR as docker registry and have updated Elastic Beanstalk role to be able to pull images from ECR.我将 ECR 用作 docker 注册表,并更新了 Elastic Beanstalk 角色,以便能够从 ECR 中提取图像。 https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/dg/single-container-docker-configuration.html https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/dg/single-container-docker-configuration.html

Create a docker-compose.yml file to deploy a Docker image from a hosted repository to Elastic Beanstalk.创建 docker-compose.yml 文件以将 Docker 映像从托管存储库部署到 Elastic Beanstalk。 No other files are required if all your deployments are sourced from images in public repositories.如果您的所有部署都来自公共存储库中的图像,则不需要其他文件。 (If your deployment must source an image from a private repository, you need to include additional configuration files for authentication. For more information, see Using images from a private repository.) For more information about the docker-compose.yml file, see Compose file reference on the Docker website. (如果您的部署必须从私有存储库获取映像,则需要包含其他配置文件以进行身份验证。有关更多信息,请参阅使用来自私有存储库的映像。)有关 docker-compose.yml 文件的更多信息,请参阅撰写文件参考在 Docker 网站上。

However, I keep getting the following message when spinning up the environment:但是,在启动环境时,我不断收到以下消息:

Instance deployment: You must specify a Docker image in either 'Dockerfile' or 'Dockerrun.aws.json' in your source bundle.实例部署:您必须在源包中的“Dockerfile”或“Dockerrun.aws.json”中指定 Docker 映像。 The deployment failed.部署失败。

According to documentation Dockerrun.aws.json should only be required for the old AMI.根据文档Dockerrun.aws.json应该只需要旧 AMI。 Has anyone come across similar issue?有没有人遇到过类似的问题?

Found the solution.找到了解决方案。 The documentation states docker-compose.yml is the only file needed but it still needs to be zipped before being uploaded to Elastic Beanstalk environment.文档指出docker-compose.yml是唯一需要的文件,但在上传到 Elastic Beanstalk 环境之前仍需要对其进行压缩。

I have had some similar issues when migrating to docker-compose file from the dockerrun.json file.从 dockerrun.json 文件迁移到 docker-compose 文件时,我遇到了一些类似的问题。

What I did was to basically create a new app on elastic beanstalk and specify the Amazon Linux 2 platform under Docker as deployement option.我所做的基本上是在弹性 beanstalk 上创建一个新应用程序,并将Docker 下的 Amazon Linux 2 平台指定为部署选项。

Below I will attach my docker-compose.yaml file and also the Github workflow with the part of deploying to ELB if you are interested (Or if it might help someone else)下面我将附上我的 docker-compose.yaml 文件以及 Github 工作流程,如果您有兴趣(或者如果它可能对其他人有帮助)

Docker-compose.yaml, you will need to either remove the image or insert your own image tag url. Docker-compose.yaml,您需要删除图像或插入您自己的图像标签 url。

version: '3'
services:
  node-app:
    image: <IMG-TAG here e.g from ECR repository>
    ports:
      - 80:80

github.yaml github.yaml

  deploy-staging:
    runs-on: ubuntu-latest
    needs: [build]
    steps:
      - uses: actions/checkout@v2

      - name: Generate deployment package
        run: |
          zip -r deploy.zip *
      - name: Deploy to EB
        uses: einaregilsson/beanstalk-deploy@v9
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: test
          environment_name: test
          version_label: ${{ github.sha }}
          region: eu-north-1
          deployment_package: deploy.zip
          use_existing_version_if_available: true

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

相关问题 AWS Elastic Beanstalk 不支持 docker-compose.yml 吗? - is docker-compose.yml not supported in AWS Elastic Beanstalk? 如何在 AWS Elastic Container Service 中使用现有的 docker-compose.yml 文件? - How to use existing docker-compose.yml file in AWS Elastic Container Service? 如何从AWS中的开发docker-compose.yml转到已部署的docker-compose.yml - how to go from development docker-compose.yml to deployed docker-compose.yml in aws Docker 将依赖传递给 AWS Elastic Beanstalk - Docker compose depedency pass to AWS Elastic Beanstalk 我可以将 AWS Copilot 与 docker-compose.yml 文件一起使用吗? - Can I use AWS Copilot with docker-compose.yml file? 从 AMI 构建 AWS Elastic Beanstalk 平台 - Building an AWS Elastic Beanstalk platform from an AMI AWS Elastic Beanstalk上的Docker中的Docker - Docker in docker on AWS Elastic Beanstalk AWS ECS-CLI docker-compose.yml depends_on 错误“services.nginx.depends_on.0 必须是字符串” - AWS ECS-CLI docker-compose.yml depends_on error "services.nginx.depends_on.0 must be a string" AWS Elastic Beanstalk:更新平台版本和自定义AMI - AWS Elastic Beanstalk: Update Platform Version & custom AMI 尝试使用Ubuntu AMI启动AWS Elastic beantalk实例 - Trying to launch AWS Elastic beanstalk instance with Ubuntu AMI
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM