taskcat
taskcat copied to clipboard
Add rm=True to docker build to reduce disk usage
Summary
Add rm=True parameter to docker.APIClient().build() to automatically remove intermediate containers after each layer is created.
Problem
Currently, TaskCat leaves intermediate containers after Docker builds, consuming significant disk space:
- ~225MB of intermediate containers per build
- Containers accumulate across multiple builds
- Problematic in disk-constrained environments (e.g., AWS CloudShell with 1GB limit)
Solution
Set rm=True in the build() method to remove intermediate containers immediately after each layer image is created.
Benefits
- Reduces disk usage by ~30% (from 740MB to 515MB in test case)
- Prevents container accumulation across multiple builds
- Layer images are still preserved (no loss of functionality)
- Better user experience in resource-constrained environments
Testing
Tested on AWS CloudShell (1GB disk limit) building a Go Lambda function (cfn-ecr-aws-soci-index-builder) with the following results:
Before (rm=False):