You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Pass build params to docker/finch CLI #8656
I have a SAM application with multiple AWS lambda functions, that are image based.
Right now we run our CICD pipeline of a Jenkins server that runs on EC2.
All the intermediate docker layers are caches on the instance itself.
We are moving our Jenkins stack (workers and controller) from running on EC2 to EKS, so the layers won't be cached.
There is a solution for this with docker buildkit: --cache-to and --cache-from.
What is a sutible solution for this when using AWS SAM?
In #8661, I've added the framework for using docker buildkit. I believe once this is merged, it should be possible to use the --cache-to and --cache-from options with BuildKit via the DockerBuildArgs section in the Metadata of the template:
When running sam build --use-buildkit it indeed finishes the build, but it seems that the layers might not be cached to ECR as I expected, I don't see any new images in my cache repo, after running sam build.
When investigating with kiro, it mentioned this, so it might be related:
But looking at the actual code in CLIBuildClient.build_image, all DockerBuildArgs entries are passed as --build-arg:
Hello @royassis, I previously had misunderstood the difference between the build args that are passed to the Dockerfile and the build params that would be passed to the CLI.
That being said, I'm opening up a new PR to give the functionality that you're asking for: #8913. It's still in draft right now as I fill out the functionality with more tests (as well as testing manually myself), but this should accomplish what you're looking for.
Basically, you just need to provide a list of params that you want to use in the metadata. I'm going to close this as completed, but if you have more questions or issues just reopen it and I'll take another look.
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
reedham-aws commentedon Feb 16, 2026
In #8661, I've added the framework for using docker buildkit. I believe once this is merged, it should be possible to use the
--cache-toand--cache-fromoptions with BuildKit via the DockerBuildArgs section in the Metadata of the template:I haven't thought too much about using other methods to achieve this, but I think this will work with your existing flow once merged.
seshubaws commentedon Mar 16, 2026
Hi @royassis, #8661 will be available to use in the next release, coming later this week or early next week. Thank you for your patience!
royassis commentedon Mar 16, 2026
I'm very excited. Thank you.
royassis commentedon Mar 19, 2026
Hey @seshubaws
I tried to use cache-from and cache-to like so:
When running
sam build --use-buildkitit indeed finishes the build, but it seems that the layers might not be cached to ECR as I expected, I don't see any new images in my cache repo, after runningsam build.When investigating with kiro, it mentioned this, so it might be related:
seshubaws commentedon Mar 20, 2026
Hi @royassis, thanks for raising this! It seems we will have to implement a workaround for this so that the correct args get passed to DockerCLI.
royassis commentedon Mar 21, 2026
Should we open a feature request?
reedham-aws commentedon Apr 11, 2026
Hello @royassis, I previously had misunderstood the difference between the build args that are passed to the Dockerfile and the build params that would be passed to the CLI.
That being said, I'm opening up a new PR to give the functionality that you're asking for: #8913. It's still in draft right now as I fill out the functionality with more tests (as well as testing manually myself), but this should accomplish what you're looking for.
Sorry this took so long!
[-]Intermediate layer caching on EKS[/-][+]Feature Request: Pass build params to docker/finch CLI[/+]reedham-aws commentedon Apr 28, 2026
Hello @royassis, support for this was added in version 1.159.1. I believe your solution would look something like this:
Basically, you just need to provide a list of params that you want to use in the metadata. I'm going to close this as completed, but if you have more questions or issues just reopen it and I'll take another look.
github-actions commentedon Apr 28, 2026
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.