简体   繁体   English

每个 docker 撰写 yml 文件是否与 AWS ECS 容器兼容

[英]Does every docker compose yml file is compatible with AWS ECS containers

I have a docker-compose yml file.我有一个 docker-compose yml 文件。 It contains 11 services/sections.它包含 11 个服务/部分。 I am able to successfully deploy it on Ubuntu EC2 instance.我能够在 Ubuntu EC2 实例上成功部署它。

Now, I need to host each service/ section from Docker Compose inside AWS ECS.现在,我需要在 AWS ECS 中托管 Docker Compose 中的每个服务/部分。 As per my understanding, I need to create a task definition from AWS ECS UI.据我了解,我需要从 AWS ECS UI 创建一个任务定义。 I can look at my docker-compose file for image details, environment variables, labels, and just add it inside the task definition.我可以查看我的 docker-compose 文件以获取图像详细信息、环境变量、标签,然后将其添加到任务定义中。 Then, start the task.然后,开始任务。 Now, my ECS tasks should work without any additional settings.现在,我的 ECS 任务应该可以在没有任何额外设置的情况下工作。

Is this a correct understanding that any service/section docker-compose yml file is ECS compatible?这是对任何服务/部分 docker-compose yml 文件与 ECS 兼容的正确理解吗?

To my understanding, ECS still doesn't allow the build command in docker-compose.yml so you will run into some headaches.据我了解,ECS 仍然不允许 docker-compose.yml 中的构建命令,因此您会遇到一些麻烦。 You can build separate images on ECR and have your docker-compose file to run those when you are creating your services.您可以在 ECR 上构建单独的映像,并让您的 docker-compose 文件在您创建服务时运行这些映像。 Don't forget to rebuild those images when you are deploying new code.部署新代码时不要忘记重建这些映像。

Sample docker-compose file示例 docker-compose 文件

version: '3'
services:
  web:
    container_name: web
    image: some_repository/web:latest
  db:
    container_name: db
    image: some_other_repo/db:latest

Hope this helps.希望这可以帮助。

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

相关问题 将 Docker-Compose YML 部署到 AWS ECS - Deploy Docker-Compose YML to AWS ECS 在AWS ECS中使用docker-compose.yml和ecs-params.yml文件以不同的Lauch类型和卷安装来运行多个任务定义 - Run multiple task-definition using docker-compose.yml and ecs-params.yml file in AWS ECS with different lauch type and volume mounting 通过 Docker 部署到 AWS ECS Compose ECS 插件具有不稳定的网络和容器 - Deploying to AWS ECS via Docker Compose ECS Plugin has unstable networks & containers 我可以将 AWS Copilot 与 docker-compose.yml 文件一起使用吗? - Can I use AWS Copilot with docker-compose.yml file? AWS ECS上的Docker容器始终显示已停止 - Docker containers on AWS ECS always shows STOPPED Docker在AWS ECS中创建了许多容器 - Docker creates many containers in AWS ECS AWS ECS 不支持在 docker 组合中部署标签 - Deploy labels in docker compose not supported by AWS ECS 使用 Docker 在 AWS ECS 上使用 Github 操作进行 Compose - Deploy with Docker Compose on AWS ECS with Github actions 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" 为 Amazon ECS 的 Docker 组合文件设置端口 - Set ports on a Docker compose file for Amazon ECS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM