DockerImageCode: docker build fails on Apple silicon
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
The following code:
```typescript
const dockerLambda = new DockerImageFunction(this, 'dockerFunction', {
code: DockerImageCode.fromImageAsset('path',{
cacheDisabled: true,
platform: Platform.LINUX_AMD64
}),
memorySize: 3008,
timeout: Duration.seconds(30)
});
```
works randomly about 1/5 of the time on my macbook, but seems to work reliably on an ubuntu x86 VM.
The error is regarding how one specific layer cannot be pushed, and how lambda can't use it since it hasn't stabilized yet.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
Expected to build my docker from the Dockerfile and deploy with no errors.
### Current Behavior
On Apple Silicon there seems to be an error.
First time:
```
(347AB729) Resource handler returned message: "Lambda function -347AB7-CJVpjHMzkl8f reached terminal FAILED state due to InvalidImage(ImageLayerFailure: UnsupportedImageLayerDetected - Layer Digest sha256:) and failed to stabilize" (RequestToken: 1d2edfb3-09ef-a4a6-b356-72029656351a, HandlerErrorCode: NotStabilized)
```
After the first time:
```
| 9:22:59 AM | CREATE_FAILED | AWS::Lambda::Function | (347AB729) Resource handler returned message: "Lambda function -d39w2Cx1DtJT reached terminal FAILED state due to InvalidImage(ImageLayerFailure: UnsupportedImageLayerDetected - Layer Digest sha256:) and failed to stabilize" (RequestToken: 60b31552-2d36-a508-741f-99c9ef057c50, HandlerErrorCode: NotStabilized)
❌ MdhostingStack failed: Error: The stack named failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Lambda function reached terminal FAILED state due to InvalidImage(ImageLayerFailure: UnsupportedImageLayerDetected - Layer Digest sha256:) and failed to stabilize" (RequestToken: 60b31552-2d36-a508-741f-99c9ef057c50, HandlerErrorCode: NotStabilized)
```
### Reproduction Steps
Create a CDK with a Lambda Function that uses `DockerImageFunction` that uses `DockerImageCode` on Apple Silicon and try deploying it.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.173.2
### Framework Version
_No response_
### Node.js Version
22.0.0
### OS
OSX 15.3.1
### Language
TypeScript
### Language Version
TypeScript (5.6.3)
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing the DockerImageFunction/DockerImageCode.fromImageAsset deployment on Apple Silicon with platform Platform.LINUX_AMD64, comparing it with the reported Ubuntu x86 behavior. Investigate the Dockerfile build and Lambda image-layer stabilization errors; done means the image builds and deploys without InvalidImage or NotStabilized failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100