title: how can I run docker containers in detached mode within a committed image
body: <p>I have pulled an image called <strong>php:5.6-apache</strong>, run it, touch a file in /var/www/html, then commit it. </p>
  
  <p>Then I try to run the new image in detached mode:</p>
  
  <pre><code># docker run --name test -d staraple/php:v1
  </code></pre>
  
  <p>But the container exited immediately after started.</p>
  
  <pre><code>IMAGE                COMMAND              CREATED                STATUS       
  staraple/php:v2  "apache2 -DFOREGROUN   4 seconds ago       Exited (0) 3 seconds ago                       
  </code></pre>
  
  <p>Fisrt I though the new image lost the <strong>CMD</strong> after a  <strong>commit</strong> action.</p>
  
  <p>Refer to <a href="https://github.com/docker/docker/pull/4000" rel="nofollow">https://github.com/docker/docker/pull/4000</a> , CMD will reserved after commit;</p>
  
  <p>My problem is why my container could not run in detached mode when I got a CMD. <strong>php.5.6-apache</strong> is official, and I just touch a blank file in it.</p>
  
  <p>ps:
      When I check json for images in /var/lib/docker/graph, I found my new image has a different Cmd config from the original one:</p>
  
  <pre><code> old:  "Cmd":["/bin/sh","-c","#(nop) CMD [apache2 -DFOREGROUND]"]
   new:  "Cmd":["apache2","-DFOREGROUND"]
  </code></pre>
  
  <p><code>docker logs</code>   show message: <code>https (pid 1) already running</code> .</p>