title: SSH example does not work with docker:git / dind image
body: <p>I'm reading the documentation: <a href="https://gitlab.ida.liu.se/help/ci/ssh_keys/README.md" rel="nofollow noreferrer">https://gitlab.ida.liu.se/help/ci/ssh_keys/README.md</a></p>
  
  <p>I'm using the current gitlab-ci.yml:</p>
  
  <pre><code>image: docker:git
  services:
  - docker:dind
  stages:
  - node_test
  - docker_one
  variables:
    DOCKER_DRIVER: overlay
  before_script:
    # Install ssh-agent if not already installed, it is required by Docker.
    # (change apt-get to yum if you use a CentOS-based image)
    - 'which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )'
    # Run ssh-agent (inside the build environment)
    - eval $(ssh-agent -s)
    # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
    - ssh-add &lt;(echo "$SSH_PRIVATE_KEY")
    # For Docker builds disable host key checking. Be aware that by adding that
    # you are suspectible to man-in-the-middle attacks.
    # WARNING: Use this only with the Docker executor, if you use it with shell
    # you will overwrite your user's SSH config.
    - mkdir -p ~/.ssh
    - ssh-keyscan -H 'gitlab.com' &gt;&gt; ~/.ssh/known_hosts
    - ssh-keyscan gitlab.com | sort -u - ~/.ssh/known_hosts -o ~/.ssh/known_hosts
    - '[[ -f /.dockerinit ]] &amp;&amp; echo -e "Host *\n\tStrictHostKeyChecking no\n\n" &gt; ~/.ssh/config'
  node_test:
    image: node:7.3.0
    stage: node_test
    script:
      - ls
  docker_one:
    stage: docker_one
    script:
      - docker info
  </code></pre>
  
  <p>node_test passes:</p>
  
  <pre><code>Running with gitlab-ci-multi-runner 1.10.4 (b32125f)
  Using Docker executor with image node:7.3.0 ...
  Starting service docker:dind ...
  Pulling docker image docker:dind ...
  Waiting for services to be up and running...
  Pulling docker image node:7.3.0 ...
  Running on runner-4e4528ca-project-2641294-concurrent-0 via runner-4e4528ca-machine-1487244621-a8ff6b11-digital-ocean-4gb...
  Cloning repository...
  Cloning into '/builds/instanty/test'...
  Checking out 0b261283 as master...
  Skipping Git submodules setup
  Identity added: /dev/fd/63 (rsa w/o comment)
  $ which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )
  /usr/bin/ssh-agent
  $ eval $(ssh-agent -s)
  Agent pid 11
  $ ssh-add &lt;(echo "$SSH_PRIVATE_KEY")
  $ mkdir -p ~/.ssh
  $ ssh-keyscan -H 'gitlab.com' &gt;&gt; ~/.ssh/known_hosts
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  $ ssh-keyscan gitlab.com | sort -u - ~/.ssh/known_hosts -o ~/.ssh/known_hosts
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  # gitlab.com SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
  $ [[ -f /.dockerinit ]] &amp;&amp; echo -e "Host *\n\tStrictHostKeyChecking no\n\n" &gt; ~/.ssh/config
  $ ls
  Build succeeded
  </code></pre>
  
  <p>It fails when I use the image docker:git and service dind:</p>
  
  <pre><code>Running with gitlab-ci-multi-runner 1.10.4 (b32125f)
  Using Docker executor with image docker:git ...
  Starting service docker:dind ...
  Pulling docker image docker:dind ...
  Waiting for services to be up and running...
  Pulling docker image docker:git ...
  Running on runner-4e4528ca-project-2641294-concurrent-0 via runner-4e4528ca-machine-1487244733-2b616928-digital-ocean-4gb...
  Cloning repository...
  Cloning into '/builds/instanty/test'...
  Checking out 0b261283 as master...
  Skipping Git submodules setup
  $ which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )
  /usr/bin/ssh-agent
  $ eval $(ssh-agent -s)
  Agent pid 14
  $ ssh-add &lt;(echo "$SSH_PRIVATE_KEY")
  /bin/sh: eval: line 50: syntax error: unexpected "("
  ERROR: Build failed: exit code 2
  </code></pre>
  
  <p>Why does this image fail?</p>