@aws-cdk/aws-ecr-assets: TarballImageAsset is not properly docker-loading image with docker 27.4 #33428
Labels
@aws-cdk/aws-ecr-assets
Related to AWS CDK Docker Image Assets
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p1
Describe the bug
Hi,
I am having a problem using
TarballImageAsset
as a grep expression used to get the image digest is not ok for the docker version/OS I am currently using.My code:
The error:
My docker environment (Mac):
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The asset tarball should be imported to local docker image cache, tagged and uploaded to ECR.
Current Behavior
The asset tarball cannot be imported to local docker image cache as the image tag is is cleaned with a
sed
expression that is not properly built for latest docker clients.Reproduction Steps
Ensure you use the latest docker version for mac, similar to this one:
Create a tarball image asset as follows:
Run a CDK synth stack with that asset.
Possible Solution
The problem seems to be the
sed
expression used here, that expectsdocker load
output to match the expressionLoaded image: <digest>
.However, in the attached docker version
docker load
actually printsLoaded image ID: <digest>
.Just changing the sed expression from
sed "s/Loaded image: //g"
tosed "s/Loaded image[^:]*: //g"
or similar should work for every scenario. For example:Additional Information/Context
No response
CDK CLI Version
2.176.0 (build 899965d)
Framework Version
No response
Node.js Version
v23.6.1
OS
Mac OS
Language
TypeScript
Language Version
typescript@^5.7.3
Other information
No response
The text was updated successfully, but these errors were encountered: