amazon-ecs-cli
amazon-ecs-cli copied to clipboard
Support docker-compose version 3.4+ to leverage multi-stage builds
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"
+1 would love this, especially when deploying golang multi stage builds
Functionality maybe:
- Build locally
- Push images to ECR based on project name (create or update ecr repos)
- Create a task if up was supplied
Also compose 3.4 introduces extension-fields.
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.).
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+.
related https://github.com/docker/cli/issues/2272
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?