aws / aws/aws-cdk

aws-ecr-assets: TarballImageAsset hardcodes container runtime.

Open
#31,317 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecr-assets bug effort/medium p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

`aws-ecr-assets.TarballImageAsset` currently hardcodes the container runtime for the image load command.

https://github.com/aws/aws-cdk/blob/v2.155.0/packages/aws-cdk-lib/aws-ecr-assets/lib/tarball-asset.ts#L80

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

None.

### Expected Behavior

`aws-ecr-assets.TarballImageAsset` should use the undocumented (https://github.com/aws/aws-cdk/issues/25657) `CDK_DOCKER` environment variable introduced by https://github.com/aws/aws-cdk/pull/23855.

Alternatively, use the proposed container runtime configuration in `cdk.json` (https://github.com/aws/aws-cdk/issues/31319).

### Current Behavior

`aws-ecr-assets.TarballImageAsset` hardcodes `docker`.

### Reproduction Steps

Using `aws-ecr-assets.TarballImageAsset` [as documented](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr_assets.TarballImageAsset.html) produces the following `{stack}.assets.json`:

```javascript
{
// ...
"dockerImages": {
"{asset hash}": {
"source": {
"executable": [
"sh",
"-c",
"docker load -i asset.{asset hash}.tar.gz | tail -n 1 | sed \"s/Loaded image: //g\""
]
},
// ...
}
}
}
```

### CDK CLI Version

2.155.0

### Framework Version

2.155.0

### Node.js Version

20.16.0

### OS

macOS 14 (Sonoma)

### Language

TypeScript

### Language Version

5.5.4

Contributor guide

Open the contributing guide

Research direction

Start in packages/aws-cdk-lib/aws-ecr-assets/lib/tarball-asset.ts around line 80 and inspect how the image load command is assembled. Reproduce the generated assets.json with TarballImageAsset, then verify that the command uses the CDK_DOCKER environment variable instead of hardcoding docker.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript
Domain
build-system, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.