简体   繁体   English

无法在AWS上使用ecs-cli部署docker

[英]Trouble deploying docker on AWS with ecs-cli

I have a repo on ECS, have created a cluster using ecs-cli 我在ECS上有一个回购,使用ecs-cli创建了一个集群

ecs-cli configure --region=us-west-2 --profile=<MY PROFILE> --cluster=cluster-1

ecs-cli up --capability-iam --keypair=<MY KEYPAIR>

but then the next step to execute the compose file is when it fails 但是,执行compose文件的下一步是失败时

ecs-cli compose --file docker-compose.yml --project-name drafter-project service up

Here's my docker-compose.yml file: 这是我的docker-compose.yml文件:

version: '2'
services:
  rabbit:
    image: rabbitmq
    hostname: rabbit1
    ports:
       - 5672:5672
       - 15672:15672
  drafter:
    build: .
    depends_on: 
      - rabbit

the errors i get here are: 我得到的错误是:

Error registering task definition 
error=ClientException: Container.image should not be null or empty.
Create task definition failed 
error=ClientException: Container.image should not be null or empty.

I'm not sure what task definitions are or what it needs. 我不确定什么是任务定义或它需要什么。

From what I understand, ecs-cli has a very limited support of the complete Docker Compose file syntax. 据我所知,ecs-cli对完整的Docker Compose文件语法的支持非常有限。 For example, you should see warnings about WARN[0000] Skipping unsupported YAML option for service... option name=build service name drafter 例如,您应该看到有关WARN[0000] Skipping unsupported YAML option for service... option name=build service name drafter

The reason is version of ecs-cli you're using is expecting all services to be images. 原因是您使用的ecs-cli版本期望所有服务都是图像。 Thus, drafter needs an image, which you can generate via docker build or a traditional docker-compose call (but then you'll need to maintain two versions of the compose file -- the traditional one and the ecs compatible one. 因此, drafter需要一个图像,您可以通过docker build或传统的docker-compose调用生成图像(但是您需要维护两个版本的compose文件 - 传统文件和ecs兼容文件)。

Note: it sounds like they may plan for build support in the future, at least according to one github comment I saw earlier (sorry, already closed the tab, so can't link to it). 注意:听起来他们可能计划在将来build支持,至少根据我之前看到的一个github评论(抱歉,已关闭选项卡,因此无法链接到它)。

The problem is in your compose file: 问题出在你的撰写文件中:

drafter:
    build: .

that will not work, you should first build and push the image: 这将无法工作,你应该首先构建并推送图像:

docker build -t drafter .
docker tag drafter:latest somepath.amazonaws.com/drafter:latest
docker push somepath.amazonaws.com/drafter:latest

so after that do: 所以在那之后:

drafter:
    image: somepath.amazonaws.com/drafter:latest

note that latest could be also a version. 请注意,最新版本也可能是版本。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM