0

Here is an example, where I can run (locally) multiple instances of a docker image with different arguments to the echo command and to AUTHOR environment variable.

NAME=Peter
docker run alpine echo "Hello $NAME"
docker run --name static-site -e AUTHOR="$NAME" -d -P dockersamples/static-site

Here I can programmatically change the value of $NAME and run the containers.

I want the same flexibility while I try to run those containers on Amazon ECS using AWS Fargate launch type. Alas, I am unable to figure out how can I programmatically provide different values to $NAME variable.

Rishabh
  • 330
  • 3
  • 12

2 Answers2

0

ecs task acts like the docker run command so

when your creating a task in the bottom you can add container details. in there you have environment vaiables.

so when your deploying programmatically you have to create a new task per each container.

0

You can override the environment variable settings when you run an existing task or create a new version of an existing task. If you click on 'create new revision' in the Task Definitions tab on the ECS Dashboard, you'll see that it lets you edit your container definitions as well. Navigate to Advanced container configuration>ENVIRONMENT and in there you should be able to add new env vars or update existing ones.

tanvi
  • 456
  • 1
  • 9
  • 26