Serverless + Docker CI/CD Build Error

Hello,

I’m attempting to schedule a long running task.

To do so, I’m using the serverless-fargate plugin to add an image to AWS ECR (Elastic Container Registry) to then be spun up by AWS Fargate.

I am deploying my Serverless app via the CI/DS integration. However, I’m getting the following error during the Serverless build:

Encountered error during executing: docker build -t serverless-nameofservice-dev:nameoftask -f /path/to/Dockerfile path/to
Output of the command:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

The relevant parts of my serverles.yml look like this:

provider:
    ecr:
    images:
      nameoftask:
        path: path/to/
        file: Dockerfile

  fargate:
  vpc:
    securityGroupIds:
      - sg-id
    subnetIds:
      - subnet-id1
      - subnet-id2
      - subnet-id3
  tasks:
    service:
      image: nameoftask

The Dockerfile looks like:

FROM node:18-alpine
WORKDIR /usr/app
COPY ./ ./
RUN npm install
ENTRYPOINT ["node"]
CMD ["app.js"]

My Serverless framework version is v2.66.2

I suspect the issue is that Docker containers are not supported by Serverless CI/CD.

Does anyone know why this error might be occurring and how to fix it?