У меня есть кластер ECS, который выполняет задачу на основе образа Docker.Раньше задача выполнялась нормально, но после добавления WORKDIR / app она больше не запускается и имеет следующую ошибку:
python: can't open file './src/main.py': [Errno 2] No such file or directory
Я считаю, что это потому, что мне нужно сопоставить том, но я не уверен, где указать это вопределение моей задачи.
Dockerfile:
FROM continuumio/miniconda3:latest
RUN mkdir /app
WORKDIR /app
RUN apt-get -y update && apt-get -y install build-essential git-core \
tesseract-ocr poppler-utils libsm6 libxext6
...
# so that custom modules can be loaded from anywhere
ENV PYTHONPATH="/app:${PYTHONPATH}"
CMD ["python", "./src/main.py"]
Определение задачи:
{
"ipcMode": null,
"executionRoleArn": null,
"containerDefinitions": [
{
"dnsSearchDomains": null,
"logConfiguration": {
"logDriver": "awslogs",
"secretOptions": null,
"options": {
"awslogs-group": "/ecs/dev-MYIMAGE",
"awslogs-region": "REGION",
"awslogs-stream-prefix": "ecs"
}
},
"entryPoint": null,
"portMappings": [],
"command": null,
"linuxParameters": null,
"cpu": 1,
"environment": [
{
"name": "ENVKEY",
"value": "ENVVAL"
},
],
"resourceRequirements": null,
"ulimits": null,
"dnsServers": null,
"mountPoints": [],
"workingDirectory": null,
"secrets": null,
"dockerSecurityOptions": null,
"memory": null,
"memoryReservation": 12288,
"volumesFrom": [],
"stopTimeout": null,
"image": "IMAGESRC",
"startTimeout": null,
"dependsOn": null,
"disableNetworking": null,
"interactive": null,
"healthCheck": null,
"essential": true,
"links": null,
"hostname": null,
"extraHosts": null,
"pseudoTerminal": null,
"user": null,
"readonlyRootFilesystem": null,
"dockerLabels": null,
"systemControls": null,
"privileged": null,
"name": "MYIMAGE"
}
],
"placementConstraints": [],
"memory": "12288",
"taskRoleArn": "ecsTaskExecutionRole",
"compatibilities": [
"EC2"
],
"taskDefinitionArn": "TASKDEF",
"family": "dev-contract-extract",
"requiresAttributes": [
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.ecr-auth"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.task-iam-role"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "ecs.capability.docker-plugin.local"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
}
],
"pidMode": null,
"requiresCompatibilities": [
"EC2"
],
"networkMode": null,
"cpu": "1024",
"revision": 5,
"status": "ACTIVE",
"proxyConfiguration": null,
"volumes": [
{
"name": "app",
"host": null,
"dockerVolumeConfiguration": {
"autoprovision": true,
"labels": null,
"scope": "shared",
"driver": "local",
"driverOpts": null
}
}
]
}
Я вполне уверен, что моя ошибка связана с отображением тома.