title: Gitlab Runner collapsed multi-line command for docker executor
body: <p>I am getting this error for one of the <code>gitlab</code> <code>ci</code> jobs when the <code>gitlab-runner</code> is using <code>docker</code> executor and one of the images I built.</p>
  <p>This is the job getting failed in <code>gitlab-ci.yml</code></p>
  <pre class="lang-yaml prettyprint-override"><code>image:
    name: 19950818/banu-terraform-ansible-cicd
  .
  .
  .
  create-ssh-key-pair:
    stage: create-ssh-key-pair
    script:
      - pwd
      - mkdir -p ~/.ssh
  
      # below lines gives the error
      - |
        # !/bin/bash
        FILE=~/.ssh/id_rsa
        if [ -f &quot;$FILE&quot; ]; then
          echo &quot;$FILE exists.&quot;
        else 
  
          ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa 2&gt;/dev/null &lt;&lt;&lt; y &gt;/dev/null
        fi
  
  </code></pre>
  <p>But these lines <strong>DON'T MAKE</strong> the error when the executor is <code>shell</code></p>
  <p>This is the <code>Dockerfile</code> for the image <code>19950818/banu-terraform-ansible-cicd</code></p>
  <pre><code>FROM centos:7
  
  ENV VER &quot;0.12.9&quot;
  
  RUN yum update -y &amp;&amp; yum install wget -y &amp;&amp; yum install unzip -y
  RUN yum install epel-release -y &amp;&amp; yum install ansible -y
  
  RUN wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip
  RUN unzip terraform_${VER}_linux_amd64.zip
  RUN mv terraform /usr/local/bin/  
  RUN rm -rf terraform_${VER}_linux_amd64.zip
  </code></pre>
  <p>Can someone please tell me what is happening and how to overcome this problem?</p>
  <p>My doubt is <code>ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa 2&gt;/dev/null &lt;&lt;&lt; y &gt;/dev/null</code> line cause the error.</p>