Open ttais2017 opened 1 year ago
Have you tried DockerImageCode.fromImageAsset
instead?
This works for me in TypeScript
const func = new lambda.DockerImageFunction(this, 'Imagefunc', {
code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, '../docker.d')),
})
If you really need fromEcr
, this works for me with tagOrDigest
prop like this:
const dockerImageAsset = new DockerImageAsset(this, 'ImageAsset', {
directory: path.join(__dirname, '../docker.d'),
})
const func = new lambda.DockerImageFunction(this, 'Imagefunc', {
// code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, '../docker.d')),
code: lambda.DockerImageCode.fromEcr(dockerImageAsset.repository, {
tagOrDigest: dockerImageAsset.imageTag,
})
})
Interesting your error message seems a golang error.
Are you deploying this manually with CDK CLI from a local env?
Hi Pahud,
Thanks for your quick feedback.
I tried once with your suggestion (DockerImageCode.fromImageAsset)
The behaviour was the same. The same error. Look the output:
ADVANCED: success: Published 79a210a49be02511e5fd475777e57dd2b515c7de73c3d93c27f1bf1ab186c746:current_account-current_region
ADVANCED: success: Published 675f6e3b4f93b056702dcd5e7382a6be803a6bd65179f29903bcb69929f5003b:current_account-current_region
ADVANCED: success: Published f70a0c153fce453690c831fc9acbf714969f0e1c19e1ee017cbedb45f662e724:current_account-current_region
ADVANCED: fail: docker login --username AWS --password-stdin https://279759165626.dkr.ecr.eu-central-1.amazonaws.com exited with error code 2: panic: assignment to entry in nil map
goroutine 1 [running]:
github.com/docker/cli/cli/config/credentials.(*fileStore).Store(0xc00060ad40, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc00011a148, ...}, ...})
/go/src/github.com/docker/cli/cli/config/credentials/file_store.go:55 +0x49
github.com/docker/cli/cli/config/credentials.(*nativeStore).Store(0xc000406078, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc00011a148, ...}, ...})
/go/src/github.com/docker/cli/cli/config/credentials/native_store.go:95 +0xb5
github.com/docker/cli/cli/command/registry.runLogin({0x1d05cd8, 0xc0003aa0f0}, {{0xc00011a140, 0x37}, {0xc00011e0a8, 0x3}, {0xc000174900, 0x8a0}, 0x1})
/go/src/github.com/docker/cli/cli/command/registry/login.go:156 +0x55d
github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0xc000005b00?, {0xc000434100?, 0x1?, 0x4?})
/go/src/github.com/docker/cli/cli/command/registry/login.go:46 +0x72
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc000005b00, {0xc00008cd80, 0x4, 0x4})
/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:940 +0x862
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000004300)
/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:1068 +0x3bd
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
/go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:992
main.runDocker(0x0?)
/go/src/github.com/docker/cli/cmd/docker/docker.go:263 +0x4b7
main.main()
/go/src/github.com/docker/cli/cmd/docker/docker.go:274 +0x97
❌ Deployment failed: Error: Failed to build asset f136923159c20e1a4158cbe775a7d300202612561b21fada800a665f3f22c3c4:current_account-current_region
at Deployments.buildSingleAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:11476)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.buildAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:150805)
at async C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:137021
Failed to build asset f136923159c20e1a4158cbe775a7d300202612561b21fada800a665f3f22c3c4:current_account-current_region
w.r.t your other question: I'm deploying with cdk deploy:
npx aws-cdk deploy MY_STACK --profile assets-repository
I have the same error log with docker login. My Docker Desktop version is 4.21.0,and I updates it to 4.21.1. It's work!~
I updated my Docker and it looks like :
I tried once to deploy, but I'm getting the same error :(
hier in text-form
`BUILD SUCCESSFUL in 37s 6 actionable tasks: 1 executed, 5 up-to-date
✨ Synthesis time: 38.17s
ADVANCED: start: Building d37ffa7c6dbeadfeecbaf54a982293c60504d4a2717881f99bbf748c4cfd4d4c:current_account-current_region ADVANCED: fail: docker login --username AWS --password-stdin https://279759165626.dkr.ecr.eu-central-1.amazonaws.com exited with error code 2: panic: assignment to entry in nil map
goroutine 1 [running]: github.com/docker/cli/cli/config/credentials.(fileStore).Store(0xc00007e220, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc000040408, ...}, ...}) /go/src/github.com/docker/cli/cli/config/credentials/file_store.go:55 +0x49 github.com/docker/cli/cli/config/credentials.(nativeStore).Store(0xc000494078, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc000040408, ...}, ...}) /go/src/github.com/docker/cli/cli/config/credentials/native_store.go:95 +0xb5 github.com/docker/cli/cli/command/registry.runLogin({0x1375cd8, 0xc0003841e0}, {{0xc000040400, 0x37}, {0xc000042118, 0x3}, {0xc0000d8900, 0x8a0}, 0x1}) /go/src/github.com/docker/cli/cli/command/registry/login.go:156 +0x55d github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0xc000005b00?, {0xc0004721c0?, 0x1?, 0x4?}) /go/src/github.com/docker/cli/cli/command/registry/login.go:46 +0x72 github.com/docker/cli/vendor/github.com/spf13/cobra.(Command).execute(0xc000005b00, {0xc000124740, 0x4, 0x4}) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:940 +0x862 github.com/docker/cli/vendor/github.com/spf13/cobra.(Command).ExecuteC(0xc000004300) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:1068 +0x3bd github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:992 main.runDocker(0x0?) /go/src/github.com/docker/cli/cmd/docker/docker.go:263 +0x4b7 main.main() /go/src/github.com/docker/cli/cmd/docker/docker.go:274 +0x97
❌ Deployment failed: Error: Failed to build asset d37ffa7c6dbeadfeecbaf54a982293c60504d4a2717881f99bbf748c4cfd4d4c:current_account-current_region at Deployments.buildSingleAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:11476) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.buildAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:150805) at async C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:137021
Failed to build asset d37ffa7c6dbeadfeecbaf54a982293c60504d4a2717881f99bbf748c4cfd4d4c:current_account-current_region`
I was able to fix this by editing ~/.docker/config.json
Somehow it was initialised in a way that meant docker couldn't handle it, so I changed from:
{
"auths": null,
...
}
to
{
"auths": {},
...
}
Great..
Will it be in the next release available?
Best Regards,
Alex Sadler @.***> schrieb am Di., 18. Juli 2023, 14:13:
I was able to fix this by editing ~/.docker/config.json Somehow it was initialised in a way that meant docker couldn't handle it, so I changed from:
"auths": null, ... }``` to
"auths": {}, ... }``` — Reply to this email directly, view it on GitHub <https://github.com/aws/aws-cdk/issues/26195#issuecomment-1640098799>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AGJTXK4RIKACMIF2RTCUOPDXQZ4XTANCNFSM6AAAAAAZ3ILZWE> . You are receiving this because you authored the thread.Message ID: ***@***.***>
I don't know, it's an issue with docker and I'm just some random person on the internet and I happen to have figured out how to work around the issue
18 Jul 2023 19:33:35 Miguel @.***>:
Great..
Will it be in the next release available?
Best Regards,
Alex Sadler @.***> schrieb am Di., 18. Juli 2023, 14:13:
I was able to fix this by editing ~/.docker/config.json Somehow it was initialised in a way that meant docker couldn't handle it, so I changed from:
"auths": null, ... }``` to
"auths": {}, ... }``` — Reply to this email directly, view it on GitHub <https://github.com/aws/aws-cdk/issues/26195#issuecomment-1640098799>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AGJTXK4RIKACMIF2RTCUOPDXQZ4XTANCNFSM6AAAAAAZ3ILZWE> . You are receiving this because you authored the thread.Message ID: ***@***.***>
— Reply to this email directly, view it on GitHub[https://github.com/aws/aws-cdk/issues/26195#issuecomment-1640745021], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAKL6JDZ3HPXG3PP5DY6KA3XQ3JHXANCNFSM6AAAAAAZ3ILZWE]. You are receiving this because you commented.[Tracking image][https://github.com/notifications/beacon/AAKL6JEZMIAZOIB7JTJRJXLXQ3JHXA5CNFSM6AAAAAAZ3ILZWGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTBZPED2.gif]
This does appear to be a docker issue. It's been fixed and merged, probably in the next docker update
Describe the bug
BUILD SUCCESSFUL in 23s 6 actionable tasks: 1 executed, 5 up-to-date
✨ Synthesis time: 23.57s
ADVANCED: start: Building 6e1cddd7d93b113a27547038f2962e6740fa861c33262dd8e6587ea19641a84b:current_account-current_region ADVANCED: fail: docker login --username AWS --password-stdin https://279280305777.dkr.ecr.eu-west-1.amazonaws.com exited with error code 2: panic: assignment to entry in nil map
goroutine 1 [running]: github.com/docker/cli/cli/config/credentials.(fileStore).Store(0xc0003cc0c0, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc0000404c8, ...}, ...}) /go/src/github.com/docker/cli/cli/config/credentials/file_store.go:55 +0x49 github.com/docker/cli/cli/config/credentials.(nativeStore).Store(0xc0000081f8, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc0000404c8, ...}, ...}) /go/src/github.com/docker/cli/cli/config/credentials/native_store.go:95 +0xb5 github.com/docker/cli/cli/command/registry.runLogin({0x12a5cd8, 0xc0003841e0}, {{0xc0000404c0, 0x34}, {0xc000042118, 0x3}, {0xc0000d8900, 0x87c}, 0x1}) /go/src/github.com/docker/cli/cli/command/registry/login.go:156 +0x55d github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0xc000005b00?, {0xc00013b240?, 0x1?, 0x4?}) /go/src/github.com/docker/cli/cli/command/registry/login.go:46 +0x72 github.com/docker/cli/vendor/github.com/spf13/cobra.(Command).execute(0xc000005b00, {0xc0003402e0, 0x4, 0x4}) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:940 +0x862 github.com/docker/cli/vendor/github.com/spf13/cobra.(Command).ExecuteC(0xc000004300) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:1068 +0x3bd github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...) /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:992 main.runDocker(0x0?) /go/src/github.com/docker/cli/cmd/docker/docker.go:263 +0x4b7 main.main() /go/src/github.com/docker/cli/cmd/docker/docker.go:274 +0x97
❌ Deployment failed: Error: Failed to build asset 6e1cddd7d93b113a27547038f2962e6740fa861c33262dd8e6587ea19641a84b:current_account-current_region at Deployments.buildSingleAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:11476) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.buildAsset (C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:150805) at async C:\Users\Rojas-GonzálezDrIngM\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:415:137021
Failed to build asset 6e1cddd7d93b113a27547038f2962e6740fa861c33262dd8e6587ea19641a84b:current_account-current_region
Expected Behavior
The Docker Image should be created
Current Behavior
An error happens trying to get credentials for ECR:
fail: docker login --username AWS --password-stdin https://279280305777.dkr.ecr.eu-west-1.amazonaws.com exited with error code 2: panic: assignment to entry in nil map
Reproduction Steps
JavaCode:
` Map<String, String> environment = new HashMap<>(); environment.put(_USECASE_LAMBDA_DOCKER_NAME, "Customized by MR!"); environment.put("DEBUG", "true"); environment.put("ls", "true"); environment.put("times", "1000");
Possible Solution
No response
Additional Information/Context
I'm using an AWS Profile for building and deploying. If the lambda function is commented out, the stack will be deployed succesfully. The error happens as soon the docker stuff will be executed. This means, the current problem is not related to the credentials I'm using via aws profile.
CDK CLI Version
2.86
Framework Version
No response
Node.js Version
9.5.1
OS
Windows
Language
Java
Language Version
No response
Other information
No response