Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecs-cli local create should docker-compose escape the env vars in entrypoint #1142

Open
remidebette opened this issue Jan 21, 2022 · 0 comments

Comments

@remidebette
Copy link

Summary

Docker-compose files generated from a task definition with ecs-cli local create should escape the environment variables present in its entrypoint.
Otherwise, the behavior on AWS ECS is not replicated on local with ecs-cli local up out of the box.

Description

Environment variables present in a Docker-compose entrypoint are not taken into account.
As explained here: https://stackoverflow.com/questions/48184700/docker-variable-expansion-in-compose-entrypoint

If you have from the AWS Task definition the following docker-compose generated:

services:
  training:
    entrypoint:
    - /bin/sh
    - -c
    - echo $CONFIG

It will not work out of the box, even though the Task definition is perfectly fine.
Therefore a manual change is necessary:

services:
  training:
    entrypoint:
    - /bin/sh
    - -c
    - echo $$CONFIG

Expected Behavior

Escape the $ tp $$ on the fly at the time of the docker-compose file creation or at the very least put a readable warning to the user if $ is detected prompting him to change the file.

Observed Behavior

With unchanged entrypoint and no warning the subsequent ecs-cli local up will start with the following docker-compose obscure warning:

$ ecs-cli local up                                                                                                            <aws:profile>
INFO[0000] The network ecs-local-network already exists 
INFO[0000] The amazon-ecs-local-container-endpoints container already exists with ID 4d0811b42103e46abf1cc24ab068d14558855e7b4c931b749040f1dc22e467b2 
INFO[0000] Started container with ID 4d0811b42103e46abf1cc24ab068d14558855e7b4c931b749040f1dc22e467b2 
INFO[0001] Using docker-compose.ecs-local.yml, docker-compose.ecs-local.override.yml files to start containers 
WARN[0000] The "CONFIG" variable is not set. Defaulting to a blank string. 

and the container will not behave as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant