在unix:///var/run/docker.sock中无法连接到Docker守护进程。 docker守护程序正在运行

我正在使用gitlab ci进行持续集成,我想对我的代码运行unit testing,然后构build一个docker镜像,然后部署它。 但是我面临的问题是如何在gilab ci中运行docker服务。

我得到这个错误

"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running" 

在我的docker build命令运行后。 我需要在gitlab-ci中安装docker吗?

这是我的.gitlab-ci.yml文件

 image: node:latest before_script: stages: - test - production - clean_up services: - docker:dind test: stage: test script: - npm install - npm install -g swagger - npm test production: type: deploy stage: production image: docker:latest script: - docker build -t testimage -t testimage:latest . - docker tag testimage docker.abc.xyz.com/testimage - docker push docker.abc.xyz.com/testimage only: - development clean_up_job: stage: clean_up script: - rm -rf node_modules - npm uninstall -g swagger when: on_failure 

目前我没有使用GitLab Runner。