fix(ecs): retain ECR images on resource deletion#6378
fix(ecs): retain ECR images on resource deletion#6378ekaya97 wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
so you think this has been happening for a long time then? @ekaya97 |
|
honestly, in my other project i didn't have this issue, this is new. i am not sure (and can't look up) what sst version that project was using. Edit: That's the issue. Pulumi runs Create/Delete on the exact same digest. That's why the image is deleted when we update a service but don't touch the Dockerfile.
Edit2: |
|
+1 for this change, I also just updated my PR for the lifecycle policy example and helper function. IMO both are an important change for $$$ and reliability. |
7808d8a to
fca6347
Compare
|
did you run
|
The docker-build provider v0.0.8 had a bug causing unnecessary delete/replace cycles on Image resources, which deleted ECR images that running ECS tasks still referenced by digest. Upgrading to v0.0.14 fixes the root cause (pulumi/pulumi-docker-build#606) instead of working around it with retainOnDelete. Fixes anomalyco#6377 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50efa0f to
7068dea
Compare
|
@mkilp yep, i have planned to check that one with the core team and provide better contribution guidelines |
vimtor
left a comment
There was a problem hiding this comment.
worked like a charm
proof of it working
tried deploying the following examples:
- aws-task
- aws-nextjs-container
- aws-python-container
- aws-hono-container
thank you @ekaya97 @mkilp @jamesgibbons92
Problem
The
docker-buildprovider deletes images from ECR when theImageresource is destroyed. This causes ECS services to fail withCannotPullContainerErrorwhen:Fixes #6377
Solution
Add
retainOnDelete: trueto the Image resource to prevent automatic image deletion. This ensures ECS task definitions can always pull their referenced image digests.Users should configure ECR lifecycle policies to clean up old untagged images periodically.
Related