0

I have an ECS Cluster with a capacity provider and a service. The capacity provider runs an autoscale group, and when one instance of this group starts, at the end I can see that there are ECS instances avalaible. Actually, I can connect to them through SSH.

The service also runs well, since it creates a new task which is based on a docker image at ERS repository. However, the task never pass from "PROVISIONING", and if I open the task I can see that the container of the task is void and loading. If I enter into my instance, I see the same docker instance if I do docker ps or docker ps -a. If I execute the agent docker exec id_docker /agent I see:

level=info time=2022-05-02T21:16:05Z msg="Successfully got ECS instance credentials from provider: EC2RoleProvider" module=instancecreds.go
level=info time=2022-05-02T21:16:05Z msg="Starting Amazon ECS Agent" version="1.61.0" commit="05730614"
level=info time=2022-05-02T21:16:05Z msg="Loading configuration"
level=info time=2022-05-02T21:16:05Z msg="Successfully got ECS instance credentials from provider: EC2RoleProvider" module=instancecreds.go

If I try with docker exec id_docker bash I get an error:

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "bash": executable file not found in $PATH: unknown

What's happening here? Any clue?

2
  • The error message seems to say it can't find the "bash" executable. Does the container have "bash" available and on the path? Does it work if you install bash? If you poke around in the ECS console, clicking around through tasks, you can often find more details of errors but I don't remember exactly where you find them.
    – Tim
    May 2 at 22:14
  • I cannot see any other logs... I have pull my docker from my ECR repo at amazon, and run it inside the EC2 instance created by the autoscaling group, and it's working fine. So it must be something related with Amazon permissions I guess. I'm using a load balancer, but there's no server on port 80 so is unhealthy in target group. Might be that? May 3 at 9:26

1 Answer 1

0

What I had after doing docker ps wsa in fact ecs-agent, which is something Amazon creates to control the container. That was the stucked part. My docker wasn't even running in fact.

To solve it, when you create the task, in the container options, when you select the ports of the container to redirect to the host, put in your host values a 0. E.g, redirect port 22 to 22 -> 0 to 22. This is a dynamic port mapping in ecs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.