title: Gitlab CI build failed with "Preparation failed: cannot connect to Docker endpoint"
body: <p>here is the <code>.gitlab-ci.yml</code> file</p>
  
  <pre><code>image: maven:3-jdk-8
  build:
     script: "mvn install -B"
  </code></pre>
  
  <p>then the build will failed with below error</p>
  
  <pre><code>Running with gitlab-ci-multi-runner 1.8.0 (734bc5d)
  Using Docker executor with image maven:3-jdk-8 ...
  ERROR: Preparation failed: cannot connect to Docker endpoint
  Will be retried in 3s ...
  Using Docker executor with image maven:3-jdk-8 ...
  ERROR: Preparation failed: cannot connect to Docker endpoint
  Will be retried in 3s ...
  Using Docker executor with image maven:3-jdk-8 ...
  ERROR: Preparation failed: cannot connect to Docker endpoint
  Will be retried in 3s ...
  ERROR: Build failed (system failure): cannot connect to Docker endpoint
  </code></pre>
  
  <p>this is how to start the runner</p>
  
  <pre><code>docker run -d --name gitlab-runner --restart always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /srv/gitlab-runner/config:/etc/gitlab-runner \
    gitlab/gitlab-runner:latest
  </code></pre>
  
  <p>this is how to config the runner</p>
  
  <pre><code>docker exec -it gitlab-runner gitlab-runner register
  
  Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
  https://gitlab.com
  Please enter the gitlab-ci token for this runner
  xxx
  Please enter the gitlab-ci description for this runner
  my-runner
  INFO[0034] fcf5c619 Registering runner... succeeded
  Please enter the executor: shell, docker, docker-ssh, ssh?
  docker
  Please enter the Docker image (eg. ruby:2.1):
  maven:3-jdk-8
  INFO[0037] Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
  </code></pre>
  
  <p>is there anything else I just missing above?</p>