1

I have a docker container (derived from PHP-CLI) that may be launched like this locally:

  • docker run php-cli-container php public/index.php argument1 argument2

I uploaded the container to Amazon AWS ECR and implemented it into an ECS scheduled task. Everything is set up properly and the task is actually running on AWS now every hour.

The input is stored in EventBridge as follows:

{
  "containerOverrides": [{
    "name": "php-api-cli",
    "command": ["php public/index.php argument1 argument2"]
  }]
}

Unfortunately, this does not seem to work. CloudWatch reports the following error:

  • /usr/local/bin/docker-php-entrypoint: 9: exec: php public/index.php argument1 argument2: not found

How do I correctly pass the argument php public/index.php argument1 argument2 into the AWS Fargate task?

1 Answer 1

0

To achieve what OP wants, we have to write:

{
  "containerOverrides": [{
    "name": "php-api-cli",
    "command": ["php", "public/index.php", "argument1", "argument2"]
  }]
}

Explanation:

AWS passes docker run php-cli-container "php public/index.php argument1 argument2" to the container in the case of OP.

To avoid that issue, we have to separate all arguments into seperate string values into the command array.

1
  • If you use the AWS console through ECS, just enter the command overrides as follows: php,public/index.php,argument1,argument2 (without spaces, quotes or brackets)
    – andreas
    Commented Mar 15, 2023 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .