How do I resolve the error "the closest matching container-instance container-instance-id encountered error 'AGENT'" for my service in Amazon ECS?

2 minuti di lettura
0

When I try to place a task in Amazon Elastic Container Service (Amazon ECS), I receive the following error: "[AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id encountered error 'AGENT'."

Resolution

This error occurs when the Amazon ECS container agent that runs on the container instance that's designated for task placement is disconnected.

To resolve this error, check your agent logs and verify that the agent is running on the instance. Then, restart the agent. 

Check your agent logs

Complete the following steps:

  1. Use SSH to connect to the container instance.
  2. Check your agent logs at /var/log/ecs/ecs-agent.log.YYYY-MM-DD-HH.
    Note: Replace the example timestamp with the timestamp for your logs.
  3. Temporarily activate DEBUG logs for ECS Agent with the ECS_LOGLEVEL flag in the /etc/ecs/ecs.config file.
  4. Run the appropriate command to restart the agent.

If the issue isn't resolved after your restart the agent, then use the debug logs to troubleshoot the issue.

Verify that the agent is running on the instance

  1. Use SSH to connect to your EC2 instance.

  2. To return a list of your containers, run the following command:

    docker ps
  3. Look for a running container that's named ecs-agent. For more information, see Why are my Amazon ECS container instances with Amazon Linux 1 AMIs disconnected?

Restart the agent

For an Amazon ECS optimized Amazon Machine Image (AMI), stop and restart the agent with the appropriate command.
For Amazon ECS optimized Amazon Linux 2 AMIs, run the following command:

sudo systemctl restart ecs

For Amazon ECS optimized Amazon Linux AMIs, run the following command:

sudo stop ecs && sudo start ecs

Related information

How do I resolve the "[AWS service] was unable to place a task because no container instance met all of its requirements" error in Amazon ECS?

How do I resolve "the closest matching container-instance container-instance-id has insufficient CPU units available" error in Amazon ECS?

Using an HTTP proxy for Amazon ECS Linux container instances

Updating the Amazon ECS container agent on an Amazon ECS optimized AMI

Manually updating the Amazon ECS container agent (for non Amazon ECS optimized AMIs)

AWS UFFICIALE
AWS UFFICIALEAggiornata 4 mesi fa