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.78k stars 303 forks source link

Can't name container when running compose service up #662

Open phadaphunk opened 5 years ago

phadaphunk commented 5 years ago

Summary

Can't name a container when using compose up.

Description

Config files

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.

phadaphunk commented 5 years ago

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?

allisaurus commented 5 years ago

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.

lmilbaum commented 4 years ago

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?