title: Docker commit image starts node repl instead of serving a website
body: <p>Goal is to NOT use a Dockerfile but to create a container, modify a container, then commit an image based off the container. It is for a course I am giving feedback on and I can NOT use a Dockerfile.</p>
  <p>I have a folder, node-test-application with the following on an Ubuntu machine:
  package.json  server.js</p>
  <p><strong>package.json</strong></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;docker_web_app&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;Node.js on Docker&quot;,
    &quot;author&quot;: &quot;First Last &lt;first.last@example.com&gt;&quot;,
    &quot;main&quot;: &quot;server.js&quot;,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;node server.js&quot;
    },
    &quot;dependencies&quot;: {
      &quot;express&quot;: &quot;^4.16.1&quot;
    }
  }
  </code></pre>
  <p><strong>server.js</strong></p>
  <pre class="lang-js prettyprint-override"><code>const express = require('express');
      
  // Constants
  const PORT = 8080;
  const HOST = '0.0.0.0';
      
  // App
  const app = express();
  app.get('/', (req, res) =&gt; {
    res.send('Hello World');
  });
      
  app.listen(PORT, HOST);
  console.log(`Running on http://${HOST}:${PORT}`);
  </code></pre>
  <p>So this is the order of operations I'm following from within node-test-application:
  Run intermediate node container</p>
  <pre><code>docker run -d -t --name nodeint -p 3009:8080 node:16
  </code></pre>
  <p>copy files from</p>
  <pre><code>docker container cp . nodeint:/app
  </code></pre>
  <p>then I enter the container:</p>
  <pre><code>docker exec -it nodeint sh
  </code></pre>
  <p>Now inside the container, I cd into app directory:</p>
  <pre><code>cd app
  </code></pre>
  <p>My files are present:
  package.json  server.js</p>
  <p>I run npm install:</p>
  <pre><code>npm install
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>added 57 packages, and audited 58 packages in 3s
  
  7 packages are looking for funding
    run `npm fund` for details
  
  found 0 vulnerabilities
  npm notice 
  npm notice New minor version of npm available! 8.11.0 -&gt; 8.12.1
  npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.12.1
  npm notice Run npm install -g npm@8.12.1 to update!
  npm notice
  </code></pre>
  <p>I run npm start:</p>
  <pre><code>npm start
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>&gt; docker_web_app@1.0.0 start
  &gt; node server.js
  
  Running on http://0.0.0.0:8080
  </code></pre>
  <p>I go to IPADDRESS:3009
  And it's serving &quot;Hello World&quot; to the browser.</p>
  <p>So now I ctrl+c then ctrl+d and I'm out of the container.</p>
  <p><code>docker ps</code> shows that the container is still running.</p>
  <p>So I:</p>
  <pre><code>docker commit nodeint nodeapp:v1
  </code></pre>
  <p>and it returns the image ID</p>
  <p>Now I expect to be able to run a container with the nodeapp:v1 image and have it serve me Hello World on the IPADDRESS:3010 port after I run the following command:</p>
  <pre><code>docker run -it --name nodeappcont -p 3010:8080 nodeapp:v1
  </code></pre>
  <p>but it gives me a node REPL:</p>
  <pre class="lang-none prettyprint-override"><code>Welcome to Node.js v16.15.1.
  Type &quot;.help&quot; for more information.
  &gt; 
  </code></pre>
  <p>And when I navigate to IPADDRESS:3010 I get nothing. Just site can't be reached.</p>
  <p>When I run image history:</p>
  <pre class="lang-none prettyprint-override"><code>docker image history nodeapp:v1
  IMAGE          CREATED         CREATED BY                                      SIZE      COMMENT
  ebf532979d69   3 minutes ago   node                                            5.83MB    
  b59df4e04d61   2 days ago      /bin/sh -c #(nop)  CMD [&quot;node&quot;]                 0B        
  &lt;missing&gt;      2 days ago      /bin/sh -c #(nop)  ENTRYPOINT [&quot;docker-entry…   0B        
  &lt;missing&gt;      2 days ago      /bin/sh -c #(nop) COPY file:4d192565a7220e13…   388B      
  &lt;missing&gt;      2 days ago      /bin/sh -c set -ex   &amp;&amp; for key in     6A010…   7.6MB     
  &lt;missing&gt;      2 days ago      /bin/sh -c #(nop)  ENV YARN_VERSION=1.22.19     0B        
  &lt;missing&gt;      2 days ago      /bin/sh -c ARCH= &amp;&amp; dpkgArch=&quot;$(dpkg --print…   95.3MB    
  &lt;missing&gt;      2 days ago      /bin/sh -c #(nop)  ENV NODE_VERSION=16.15.1     0B        
  &lt;missing&gt;      12 days ago     /bin/sh -c groupadd --gid 1000 node   &amp;&amp; use…   334kB     
  &lt;missing&gt;      12 days ago     /bin/sh -c set -ex;  apt-get update;  apt-ge…   510MB     
  &lt;missing&gt;      12 days ago     /bin/sh -c apt-get update &amp;&amp; apt-get install…   146MB     
  &lt;missing&gt;      12 days ago     /bin/sh -c set -ex;  if ! command -v gpg &gt; /…   17.5MB    
  &lt;missing&gt;      12 days ago     /bin/sh -c set -eux;  apt-get update;  apt-g…   16.5MB    
  &lt;missing&gt;      12 days ago     /bin/sh -c #(nop)  CMD [&quot;bash&quot;]                 0B        
  &lt;missing&gt;      12 days ago     /bin/sh -c #(nop) ADD file:5c5cde050dbdbd5c7…   114MB
  </code></pre>
  <p>So how do I create an node image from a container with changes that will serve a node app? Remember, without using a Dockerfile.</p>