title: Docker RUN Command: When To Group Commands, When Not To?
body: <p>I've seen two distinct methodologies of using the <code>RUN</code> command in a <code>Dockerfile</code>, which I will name v1 and v2.</p>
  
  <h1>v1</h1>
  
  <p>One command per line</p>
  
  <pre><code>FROM ubuntu/latest
  ENV DEBIAN_FRONTEND noninteractive
  
  RUN apt-get update
  RUN apt-get -y install php5-dev
  RUN libcurl4-openssl-dev
  ...
  </code></pre>
  
  <h1>v2</h1>
  
  <p>Multiple commands per line</p>
  
  <pre><code>FROM ubuntu/latest
  ENV DEBIAN_FRONTEND noninteractive
  RUN apt-get update &amp;&amp; \
      apt-get -y install \
          php5-dev \
          libcurl4-openssl-dev
  ...
  </code></pre>
  
  <p>Both methodologies have their advantages, the different approach to using caching being the most obvious. What other reasons are there to use one approach over the other?</p>
  
  <p><strong>N.B.</strong> I bow to the community's wishes if this question be considered too vague or open to opinion; however, I post it here because I expect that there are good situations to group commands, and good situations not to - and I want to know what they are.</p>