AWS ECS instance has high CPU load from dmeventd

Today we found two of our ECS instances in a cluster had unusually high CPU loads. A quick look revealed dmeventd was responsible for that.

Turns out old containers and images are not getting cleaned up by ECS.

We got back to normal levels by removing old containers and images from the instance:

sudo docker rm $(docker ps -q -f status=exited)

docker images -q | xargs --no-run-if-empty docker rmi