Reputation: 867
I am migrating a set of high-frequency scheduled tasks from Fargate to ECS within EC2 due to the overhead of always pulling images. I see that setting ECS_IMAGE_PULL_BEHAVIOR
to prefer-cached
will cause the ECS agent to avoid pulling an image that has been previously cached, but this won't work in our setup, which deploys new images overwriting the latest tag.
Is there any way to force the ECS agent to pull the image again after the image has been updated while retaining the prefer-cached
behavior after that? If not, any suggestions to work around this issue are appreciated.
Upvotes: 0
Views: 2093
Reputation: 867
There seems to be currently no way to achieve this with the ECS agent. In short, it offers only two options: use the local cache or always pull.
I guess going around the ECS agent and clearing the cache directly would work in some cases (e.g. triggering an SSM command on deployments or polling the current tag digest from within the container instances), but, arguably, it would probably be better to just adopt tag immutability.
Upvotes: 2