简体   繁体   中英

Trouble deploying docker on AWS with ecs-cli

I have a repo on ECS, have created a cluster using 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

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

Here's my docker-compose.yml file:

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. For example, you should see warnings about 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. 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.

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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