title: Why does Dockerfile RUN print echo options?
body: <p>Using latest Docker for Mac, on latest macOS.</p>
  
  <p>I have a Dockerfile:</p>
  
  <pre><code>FROM debian:8
  ENV DEBIAN_FRONTEND noninteractive
  RUN apt-get update -y -q \
      &amp;&amp; apt-get install -y -q apt-utils \
      &amp;&amp; apt-get upgrade -y -q \
      &amp;&amp; apt-get install -y -q ssh build-essential libssl-dev libffi-dev python-dev python-pip python-six openjdk-7-jdk \
      &amp;&amp; mkdir -p /etc/ansible \
      &amp;&amp; echo -e "[ssh_connection]\nssh_args = -o ControlMaster=no -o ControlPersist=60s\n" &gt; /etc/ansible/ansible.cfg
  </code></pre>
  
  <p>The problem is with the echo command. The content of the file produced by that command is:</p>
  
  <pre><code>-e [ssh_connection]
  ssh_args = -o ControlMaster=no -o ControlPersist=60s
  </code></pre>
  
  <p>The -e option is printed as well! What's even crazier the option has been picked up by echo, as evident by the newlines being parsed. In fact if I attach to a container and run the same command again, I get the correct file content. I thought this might be a problem with <code>docker build</code> quoting each argument in RUN, but even if I run <code>echo "-e" "X\nY"</code> the command prints:</p>
  
  <pre><code>X
  Y
  </code></pre>
  
  <p>Does anyone have any idea why this would happen?</p>