Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

cdk unable to Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? - error when deploying cdk

Ask Question

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

I don't know why Docker is showing error here but can you running Docker in your local and try again? – Chuong Nguyen Nov 4, 2022 at 0:58

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."

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.