[英]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.