Home > front end >  cdk unable to Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daem
cdk unable to Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daem

Time:11-04

when trying to deploy my infrastructure, I am hit with this error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ERRO[0000] Can't add file /Users/Samuel.Lawrence/uktv/Sandbox/cdk-arch/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/types.d.ts to tar: io: read/write on closed pipe 
ERRO[0000] Can't close tar writer: io: read/write on closed pipe 

My infrastructure is quite simple and looks exactly like:

Class that index: index.ts

export class CdkArchStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);
    new AnalyticsReportService(this, "AnalyticsReportServiceHandler", {});
  }
}

Class that handles the creation of the stack: AnalyticsReportService.ts

export class AnalyticsReportService extends NodejsFunction {
  constructor(scope: Stack, id: string, props: NodejsFunctionProps) {
    super(scope, id, props);
  }
}

And finally, a basic lambda function:

export const handler = async (event: any = {}): Promise<any> => {
  console.log("event: ", event);
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: "Go Serverless v2.0! Your function executed successfully!",
    }),
  };
};

what exactly am I missing? This error dosnt seem to be super common. I've logged into my aws console, so credentials definitely arnt the issue

CodePudding user response:

Docker is required in order to bundle/build the TypeScript Lambdas in the absence of esbuild. So install/start Docker or install esbuild.

Reference: "If esbuild is available it will be used to bundle your code in your environment. Otherwise, bundling will happen in a Lambda compatible Docker container with the Docker platform based on the target architecture of the Lambda function."

  • Related