title: When running node on docker (windows 10) I'm getting two responses for each listen()
body: <p>I'm following the text of <em>Kubernetes in Action</em> (Manning Books).
  Around page 28 is an exercise in running Node on Docker.
  When I use a browser to run the code, I'm getting two responses for each browser request.</p>
  <p>I'm running Windows 10 and Docker for Windows with the WSL2 backend.</p>
  <p>Here is the code of app.js:</p>
  <pre><code>// Sample program for &quot;Kubernetes in Action&quot;, page 28
  const http = require('http');
  const os = require('os');
  
  // Console output doesn't show when the &quot;docker run ... -d ...&quot; option is used.
  console.log(&quot;Kubia server starting...&quot;);
  
  // For some reason the handler is called twice for each localhost:8080
  var handler = function(request, response) {
      var dt = new Date();
      var dtString = dt.toISOString();
      console.log(&quot;Received request from &quot; + request.connection.remoteAddress + &quot; at &quot; + dtString);
      response.writeHead(200);
      response.end(&quot;You've hit &quot; + os.hostname() + &quot; at &quot; + dtString + &quot;\n&quot;);
  };
  
  var www = http.createServer(handler);
  www.listen(8080);
  </code></pre>
  <p>Here is my Dockerfile:</p>
  <pre><code>FROM node:12.18.1
  ADD app.js /app.js
  ENTRYPOINT [&quot;node&quot;, &quot;app.js&quot;]
  </code></pre>
  <p>In that directory I build the image:</p>
  <pre><code>docker build -t kubia .
  </code></pre>
  <p>And I run the code:</p>
  <pre><code>docker run --name kubia-container -p 8080:8080 kubia
  </code></pre>
  <p>From the browser I get:</p>
  <pre><code>You've hit 713d0aa4de7a at 2022-09-01T13:28:11.903Z
  </code></pre>
  <p>But my console says:</p>
  <pre><code>Kubia server starting...
  Received request from ::ffff:172.17.0.1 at 2022-09-01T13:28:11.903Z
  Received request from ::ffff:172.17.0.1 at 2022-09-01T13:28:11.929Z
  </code></pre>
  <p>Of course the browser accepts the first response it gets and ignores any following ones. But why is the server running twice for that localhost:8080 request?</p>
  <p>EDITED 9:42 AM:  When I use CMD and run curl within it, I get one call through my handler per curl request.  I get two for a browser call but one for curl.  Maybe this is a browser issue?</p>