Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 300
blue_zinc Avatar asked Jul 04 '16 20:07

blue_zinc


2 Answers

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

like image 71
Dolan Antenucci Avatar answered Sep 18 '22 15:09

Dolan Antenucci


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.

like image 39
Rubén Fanjul Estrada Avatar answered Sep 17 '22 15:09

Rubén Fanjul Estrada