blog

AWS ECS: Fixing agent container not running and exit code 5

I had a great time this week when our instance on Amazon imploded for strange reasons, sadly I don't have the logs anymore to post them here, but these were the key problems (or what I remember from the event) and their solutions:

The docker process suddenly stopped responding some commands such as docker ps

Solution: I reinstalled docker and AWS ECS Container Agent.

Docker is now responding, but the container agent will not run

By running it with the -it flags, we noticed it was exiting with code 5.

Solution: Delete the file /var/lib/ecs/data/ecs-agent-data.json and start the container agent again.