JSON not working as a command in ECS

0

I have a json command which I use to setup some configuration settings in my containers and it works fine when used with docker compose and also when I use ecs-cli to deploy it on ecs. When I try to create new revision of the task definition by changing some port values in the command it gives JSON error as it adds and addition " to the command which leads to the failure. Now the task definition created from the cli for fine if I don't touch the command. Is there a fix for it.

1개 답변
1

Putting JSON in the command might be tricky via the UI. When you use docker-compose, given it's in YAML, it is much easier to write that up.

To go from docker-compose to ECS, I would recommend to try out ECS Compose-X which will translate your docker-compose files into CFN templates. If anything, you might be able to generate the JSON/YAML template that will contain your task and containers definition which will quote / escape your JSON argument accordingly. Might help you get on the right track.

As an alternative, something I have done in multiple places, you can set a complex string value as an environment variable and use that in the command.

Hope this helps,

profile picture
답변함 2년 전
  • So basically what we want is to have task definition and the make changes to it depending on situation , we want to move away from the cli and spin up multiple containers with different ports form the task definition which we will be able to control through lambda . In our use case we don't want have to access cli options.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠