doudong2149 2019-07-17 05:51
浏览 97
已采纳

我有一个php文件并使用Dockerfile构建。 在我的php文件中,如何从AWS Batch Job Definitions中获取参数集?

How to access the parameters set in AWS Batch Job Definition in my php file?

Job Definition JSON

{
    "jobDefinitionName": "...",
    "jobDefinitionArn": "...",
    "revision": 6,
    "status": "ACTIVE",
    "type": "container",
    "parameters": {
        "category_name": "job definition category"
    },
    "containerProperties": {
        ...
    }
}

This is my Dockerfile

FROM php:7.2
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./hello-world.php"]

This is my php file. "hello-world.php"

$parameters = getenv('parameters');
echo 'display the aws job parameters here: ' . json_encode($parameters);

I should have get the parameters set in AWS Batch Job.

  • 写回答

1条回答 默认 最新

  • duangan4406 2019-07-17 08:13
    关注

    I found the solution. To get the passed parameters, you have to use Ref::name_of_parameter. Then on your php file, just used "$argv" to get the parameters.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?