[英]CannotStartContainerError: ResourceInitializationError: failed to create new container runtime task: failed to create shim: OCI runtime create failed:
Here's the full error message:这是完整的错误消息:
CannotStartContainerError: ResourceInitializationError: failed to create new container runtime task: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/": permission denied: unknown Entry point
CannotStartContainerError:ResourceInitializationError:创建新容器运行时任务失败:创建垫片失败:OCI 运行时创建失败:container_linux.go:380:启动容器进程导致:exec:“/”:权限被拒绝:未知入口点
I have an application that I created a docker image with and had it working fine on lambda. The image is on ECR.我有一个应用程序,我用它创建了一个 docker 图像,并让它在 lambda 上正常工作。图像在 ECR 上。 I deleted my lambda function, created a docker container in ECS from that image and utilized Fargate.
我删除了我的 lambda function,从该映像在 ECS 中创建了一个 docker 容器并使用了 Fargate。
here is my main.tf file in my ECS module on Terraform that I used to create this task.这是我用于创建此任务的 Terraform 上 ECS 模块中的 main.tf 文件。
resource "aws_ecs_cluster" "cluster" {
name = "python-cloud-cluster"
}
resource "aws_ecs_service" "ecs-service" {
name = "python-cloud-project"
cluster = aws_ecs_cluster.cluster.id
task_definition = aws_ecs_task_definition.pcp-ecs-task-definition.arn
launch_type = "FARGATE"
network_configuration {
subnets = var.service_subnets
security_groups = var.pcp_service_sg
assign_public_ip = true
}
desired_count = 1
}
resource "aws_ecs_task_definition" "pcp-ecs-task-definition" {
family = "ecs-task-definition-pcp"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
memory = "1024"
cpu = "512"
task_role_arn = var.task_role_arn
execution_role_arn = var.task_role_arn
container_definitions = <<EOF
[
{
"name": "pcp-container",
"image": "775362094965.dkr.ecr.us-west-2.amazonaws.com/weather-project:latest",
"memory": 1024,
"cpu": 512,
"essential": true,
"entryPoint": ["/"],
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
]
}
]
EOF
}
I found a base template online and altered it to fit my needs.我在网上找到了一个基本模板并对其进行了修改以满足我的需要。 I just realized the entry point is set to ["/"] in the task definition, which was default from the template I used.
我刚刚意识到任务定义中的入口点设置为 ["/"],这是我使用的模板的默认值。 What should I be setting it to?
我应该将其设置为什么? Or this error caused by a different issue?
或者这个错误是由其他问题引起的?
entryPoint is optional , and you don't have to specify it if you don't know what it is.entryPoint是可选的,如果您不知道它是什么,则不必指定它。
In your case it is /
which is incorrect.在您的情况下,它是
/
这是不正确的。 It should be some executable (eg /bin/bash
), and it depends on your container and what the container does.它应该是一些可执行文件(例如
/bin/bash
),并且它取决于您的容器和容器的作用。 But again, its optional.但同样,它是可选的。
You have to check documentation of your weather-project
container, and see what exactly it does and how to use it.你必须检查你的
weather-project
容器的文档,看看它到底做了什么以及如何使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.