Get Hands-on with Amazon EKS - Workshop Event Series
Whether you're taking your first steps with Kubernetes or you're an experienced practitioner looking to sharpen your skills, our Amazon EKS workshop series delivers practical, real-world experience that moves you forward. Learn directly from AWS solutions architects and EKS specialists through hands-on sessions designed to build your confidence with Kubernetes. Register now and start building with Amazon EKS!
How can I automate the cleanup of Docker containers and images in Amazon ECS?
1 minute read
0
I want to automatically clean up Docker containers and images in Amazon ECS.
Resolution
The Amazon ECS container agent (for versions 1.13.0 or later) automatically cleans up stopped tasks and Docker images that aren't used by tasks on your container instances. By default, stopped tasks and Docker images are cleaned up and the containers are removed every three hours.
To change the wait period before a container is removed, use the ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION variable.
Important: If you set ECS_DISABLE_IMAGE_CLEANUP to true, then automated image cleanup is turned off on your container instance and your images aren't automatically removed.