CannotStartContainerError提交AWS批处理作业

AWS Batch我有一个job definition ,一个job queue和一个执行我的AWS Batch jobscompute environment 。 提交工作后,我发现它在失败的列表中有这个错误:

 Status reason Essential container in task exited Container message CannotStartContainerError: API error (404): oci runtime error: container_linux.go:247: starting container process caused "exec: \"/var/application/script.sh --file= --key=. 

cloudwatch logs我有:

 container_linux.go:247: starting container process caused "exec: \"/var/application/script.sh --file=Toulouse.json --key=out\": stat /var/application/script.sh --file=Toulouse.json --key=out: no such file or directory" 

我已经指定了一个包含所有脚本的正确的docker镜像(我们已经使用了它,并且工作正常),我不知道错误来自哪里。 任何build议,非常感激。

docker文件是这样的:

 # Pull base image. FROM account-id.dkr.ecr.region.amazonaws.com/application-image.base-php7-image:latest VOLUME /tmp VOLUME /mount-point RUN chown -R ubuntu:ubuntu /var/application # Create the source directories USER ubuntu COPY application/ /var/application # Register aws profile COPY data/aws /home/ubuntu/.aws WORKDIR /var/application/ ENV COMPOSER_CACHE_DIR /tmp RUN composer update -o && \ rm -Rf /tmp/* 

这里是Job Definition

 { "jobDefinitionName": "JobDefinition", "jobDefinitionArn": "arn:aws:batch:region:accountid:job-definition/JobDefinition:25", "revision": 21, "status": "ACTIVE", "type": "container", "parameters": {}, "retryStrategy": { "attempts": 1 }, "containerProperties": { "image": "account-id.dkr.ecr.region.amazonaws.com/application-dev:latest", "vcpus": 1, "memory": 512, "command": [ "/var/application/script.sh", "--file=", "Ref::file", "--key=", "Ref::key" ], "volumes": [ { "host": { "sourcePath": "/mount-point" }, "name": "logs" }, { "host": { "sourcePath": "/var/log/php/errors.log" }, "name": "php-errors-log" }, { "host": { "sourcePath": "/tmp/" }, "name": "tmp" } ], "environment": [ { "name": "APP_ENV", "value": "dev" } ], "mountPoints": [ { "containerPath": "/tmp/", "readOnly": false, "sourceVolume": "tmp" }, { "containerPath": "/var/log/php/errors.log", "readOnly": false, "sourceVolume": "php-errors-log" }, { "containerPath": "/mount-point", "readOnly": false, "sourceVolume": "logs" } ], "ulimits": [] } } 

在Cloudwatch日志stream/ var / log / docker中:

 time="2017-06-09T12:23:21.014547063Z" level=error msg="Handler for GET /v1.17/containers/4150933a38d4f162ba402a3edd8b7763c6bbbd417fcce232964e4a79c2286f67/json returned error: No such container: 4150933a38d4f162ba402a3edd8b7763c6bbbd417fcce232964e4a79c2286f67" 

这个错误是因为命令格式不正确。 我使用boto3通过lambda函数(python 2.7)提交作业,命令的语法应该是这样的:

 'command' : ['sudo','mkdir','directory'] 

希望它有助于某人。