I have a working container in Amazon\'s ECS that runs a program as a task. I would like to pass some program arguments, as I would do when running locally with docker run<
When you run a task in ECS you can specify container overrides.
In the AWS console this can be found at the bottom in the Advanced Options section.
On the CLI you can pass in a JSON object with the overrides like so:
aws ecs run-task ... --overrides '{"containerOverrides": [{"name": "whatever", "command": ["foo", "bar"}]}'
The command
is the CMD
that gets executed inside the container.
In the same way environment variables can be passed to a container. Here's the list of possible options as described in the aws-cli docs:
{
"containerOverrides": [
{
"name": "string",
"command": ["string", ...],
"environment": [
{
"name": "string",
"value": "string"
}
...
],
"cpu": integer,
"memory": integer,
"memoryReservation": integer
}
...
],
"taskRoleArn": "string",
"executionRoleArn": "string"
}
For some reason the name
always has to be set in the overrides. ¯\_(ツ)_/¯