title: Error on running docker commands from jenkins pipleline
body: <p>I am trying to run a bash file inside a docker container in jenkins pipeline. Here is my bash file which compares two arrays and prints something if they are different:</p>
  
  <pre><code>// path/to/file/my-bash.sh
  #!/bin/bash
  
  array1="some array"
  array2="some array"
  
  result=$(echo ${array1[@]} ${array2[@]} | tr ' ' '\n' | sort | uniq -u)
  
  [ ! -z "$result" ] &amp;&amp; echo "different arrays"
  </code></pre>
  
  <p>and here is the jenkins pipeline stage:</p>
  
  <pre><code>stage('Running the bash file') {
      sh """#!/bin/bash -l
          docker-compose -f docker-compose.yml -p "${env.BUILD_TAG}" exec -T --user it php bash -l -c "cd /path/to/file &amp;&amp; ./my-bash.sh" &gt; result.txt
      """
  }
  </code></pre>
  
  <p>Probably this line <code>result=$(echo ${array1[@]} ${array2[@]} | tr ' ' '\n' | sort | uniq -u)</code> causes the problem because without it everything works fine. But I don't know what the problem is.</p>