title: How to test Dockerfile RUN and CMD?
body: <p>I'm trying to understand how Dockerfile's RUN and CMD works.</p>
  
  <p>From: <a href="https://docs.docker.com/engine/reference/builder/" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/builder/</a></p>
  
  <blockquote>
    <p>The <code>RUN</code> instruction will execute any commands in a new layer on top
       of the current image and commit the results. The resulting committed
       image will be used for the next step in the <code>Dockerfile</code>.</p>
    
    <p>The main purpose of a <code>CMD</code> is to provide defaults for an executing container.</p>
  </blockquote>
  
  <p>And just to test if the <code>RUN</code> and <code>CMD</code> commands are executed from my <code>Dockerfile</code>, I have</p>
  
  <pre><code>RUN touch "RUN.s.txt"
  CMD touch "CMD.s.txt"
  </code></pre>
  
  <p>None of those command are executed, otherwise I'll see those two files created.
  So what went wrong?</p>