aws / amazon-ecs-cli

The Amazon ECS CLI enables users to run their applications on ECS/Fargate using the Docker Compose file format, quickly provision resources, push/pull images in ECR, and monitor running applications on ECS/Fargate.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html
Other
1.77k stars 302 forks source link

Support docker-compose version 3.4+ to leverage multi-stage builds #781

Open rybakit opened 5 years ago

rybakit commented 5 years ago

Summary

Currently, ecs-cli only supports major docker compose versions, like 2.0, 3.0. However, version 3.4 introduced multi-stage builds which allows building complex but efficient images within a singe Dockerfile. It would be greate if ecs-cli could support this feature.

Description

Linux

Config files

version: '3.4'

services:
  api:
    image: ${CONTAINER_REGISTRY_BASE}/foobar:${CONTAINER_REGISTRY_VERSION}
    build:
      context: ./foobar
      target: foobar_nginx
    ports:
      - "80:80"
    logging:
      driver: awslogs
      options:
        awslogs-group: foobar
        awslogs-region: eu-central-1
        awslogs-stream-prefix: foobar

Expected Behavior

The command succeeds without errors.

Observed Behavior

The command fails with:

ERRO[0000] Unable to open ECS Compose Project            error="Unsupported Docker Compose version found: 3.4"                                                                                                                                
FATA[0000] Unable to create and read ECS Compose Project  error="Unsupported Docker Compose version found: 3.4"   
MichaelCombs28 commented 5 years ago

+1 would love this, especially when deploying golang multi stage builds

Functionality maybe:

  1. Build locally
  2. Push images to ECR based on project name (create or update ecr repos)
  3. Create a task if up was supplied
sevdog commented 5 years ago

Also compose 3.4 introduces extension-fields.

diablodale commented 2 years ago

And there is an incompatibility with healthcheck.

official spec defines that the yaml healthcheck.start_period is only supported in file version 3.4 https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck This means, that the field at the start of a docker-compose.yml file must write version: '3.4' or greater. If 3.4 is not written, then official docker-compose tool throws error

ERROR: The Compose file './xxxxx.yml' is invalid because:
services.xxxxxxx.healthcheck value Additional properties are not allowed ('start_period' was unexpected)

But ecs cli doesn't support writing 3.4 at the top. This means that it is not possible to declare the start_period attribute in a docker-compose file which is used across stages (local, LAN, AWS EC2, AWS ECS, etc.).

Achilles0509 commented 2 years ago

Unsupported Docker Compose version found: 3.8

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html When will ecs-cli support minor versions like 3.8? I would like to common variable function which is introduced docker-compose 3.4+.

diablodale commented 2 years ago

related https://github.com/docker/cli/issues/2272

saygun commented 2 years ago

Is there a certain reason for not supporting minor versions? Do we have to wait until version 4 for being able to use common variables?