amazon-ecs-cli
amazon-ecs-cli copied to clipboard
Can't name container when running compose service up
Summary
Can't name a container when using compose up.
Description
-
Which specific command was run?
ecs-cli compose --file docker-compose-master.yml --project-name CieblinkTask service up --deployment-min-healthy-percent 0 --target-group-arn [myarn] --container-name apache --container-port 80 --role ECSAdmin -
Which version of the CLI you are using? (Run:
ecs-cli --version) 1.10.0 -
What platform are you using to run ECS CLI commands? (E.g. Linux, MacOSX, Windows) Windows
Config files
-
docker-compose.yml
version: '3' services: apache: image: xx.dkr.ecr.ca-central-1.amazonaws.com/cieblink-apache-ecr:latest hostname: cie-apache ports: - 80:80 depends_on: - php php: image: xx.dkr.ecr.ca-central-1.amazonaws.com/cieblink-php-ecr:latest hostname: cie-php -
ecs-params.yml
version: 1 task_definition: services: apache: cpu_shares: 300 mem_limit: 2GB php: cpu_shares: 300 mem_limit: 2GB
Expected Behavior
I would expect to be able to name my container from within the docker-compose.yml existing container_name setting or to have some sort of other way of naming the container.
Observed Behavior
When I go into ECS and run docker ps to see my current running containers they are named something like ecs-CieblinkTask-42-apache-dcb9d8f6df9b8ddaa8. This is causing me a lot of problems when I try to reference them inside a configuration like this one :
<FilesMatch .php$>
SetHandler "proxy:fcgi://[MY_CONTAINER_NAME]:9000"
</FilesMatch>
since I cannot access the container.
Kind of fixed as I found a workaround.
I use links instead of depends_on since it is not supported at the moment. I can then reference my container by using it's name in the docker-compose.yml.
Still could be nice to be have the ability to rename our containers. Should this be changed to a feature request?
Hi @phadaphunk - glad you found a workaround! Yes, let's consider this a feature request since container_name isn't currently supported. Thank you for explaining your use case for it.
Was this use case ever resolved? Can we use ecs-params.yaml to set the container_name? One of my containers is an ngnix which reference to another container. The reference name is backed into the ngnix container. Any ideas how can I go about it?