amazon-ecs-cli icon indicating copy to clipboard operation
amazon-ecs-cli copied to clipboard

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

Open rybakit opened this issue 5 years ago • 6 comments

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

  • Which specific command was run?
ecs-cli compose --project-name foobar service up --create-log-groups --cluster-config foobar
  • Which version of the CLI you are using?
ecs-cli version 1.14.1 (f73f9e3)
  • What platform are you using to run ECS CLI commands? (E.g. Linux, MacOSX, Windows)

Linux

Config files

  • docker-compose.yml
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"   

rybakit avatar May 27 '19 13:05 rybakit

+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

MichaelCombs28 avatar Aug 13 '19 18:08 MichaelCombs28

Also compose 3.4 introduces extension-fields.

sevdog avatar Aug 16 '19 14:08 sevdog

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

diablodale avatar Oct 29 '21 18:10 diablodale

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

Achilles0509 avatar Nov 30 '21 09:11 Achilles0509

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

diablodale avatar Nov 30 '21 13:11 diablodale

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?

saygun avatar Jan 04 '22 19:01 saygun