title: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running
body: <p>I am using gitlab ci for continues integration, I want to run unit test on my code and then build a docker image and then deploy it.
  But the problem which I am facing is that how to run a docker service in gilab ci.</p>
  
  <p>I get this error </p>
  
  <pre><code>"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running"
  </code></pre>
  
  <p>after my docker build command is run.
  do I need to install docker in gitlab-ci?</p>
  
  <p>This is my .gitlab-ci.yml file</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am not using GitLab Runner at the moment.</p>