aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.38k stars 3.79k forks source link

cdk-assets: Improve error message when docker is not installed and CDK_DOCKER is not set. #25657

Open vsiravar opened 1 year ago

vsiravar commented 1 year ago

Describe the bug

When docker is not installed and a user wants to use a drop in replacement, if the user does not set CDK_DOCKER=, the error message says "Unable to execute 'docker' in order to build a container asset. Please install 'docker' and try again." https://github.com/aws/aws-cdk/blob/main/packages/cdk-assets/lib/private/docker.ts#L186

Expected Behavior

Error message should inform users about CDK_DOCKER environment variable which can be set to support drop in replacements for docker.

Current Behavior

Error message is very docker specific. "Unable to execute 'docker' in order to build a container asset. Please install 'docker' and try again."

Reproduction Steps

  1. Uninstall docker.
  2. Clone https://github.com/aws/aws-cdk/
  3. yarn install
  4. NODE_OPTIONS=--max-old-space-size=8192 npx lerna run build --scope=aws-cdk-lib --scope=@aws-cdk-testing/framework-integ
  5. cd packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test && node integ.bundling.js

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.79.1 (build 2e7f8b7)

Framework Version

No response

Node.js Version

v18.16.0

OS

macOS 13.3.1

Language

Typescript

Language Version

No response

Other information

No response

pahud commented 1 year ago

Yes we should add CDK_DOCKER in our document or contributing guide. But at this moment, according to the Setup of the contributing guide, Docker >=19.03 with the running daemon is required.

pahud commented 1 year ago

related to https://github.com/aws/aws-cdk/issues/23680#issuecomment-1406516147

vsiravar commented 1 year ago

Makes sense, should it additionally be added to the error message as well, informing the user to either set CDK_DOCKER or have a docker daemon running when either of the dependencies are not configured?