3

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

I have an application that I created a docker image with and had it working fine on lambda. The image is on ECR. I deleted my lambda function, created a docker container in ECS from that image and utilized Fargate.

here is my main.tf file in my ECS module on Terraform that I used to create this task.

    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?

1 Answer 1

4

entryPoint is optional, and you don't have to specify it if you don't know what it is.

In your case it is / which is incorrect. It should be some executable (e.g. /bin/bash), and it depends on your container and what the container does. 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.