title: NodeJS in Docker doesn't see connection
body: <p>I have a NodeJS/Vue app that I can run fine until I try to put it in a Docker container.  I am using project structure like:</p>
  
  <p><a href="https://i.stack.imgur.com/nWyN5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nWyN5.png" alt="enter image description here"></a></p>
  
  <p>When I do <code>npm run dev</code>  I get the output:</p>
  
  <pre><code>listmymeds@1.0.0 dev /Users/.../projects/myproject
  webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
  </code></pre>
  
  <p>and then it builds many modules before giving me the message:</p>
  
  <pre><code> DONE  Compiled successfully in 8119ms                                                                                                                                                                  
   I  Your application is running here: http://localhost:8080                                                                                                                                                       
  </code></pre>
  
  <p>then I am able to connect via browser at localhost:8080</p>
  
  <p>Here is my Dockerfile:</p>
  
  <pre><code>FROM node:9.11.2-alpine
  RUN mkdir -p /app
  WORKDIR /app
  COPY package.json /app
  RUN npm install
  COPY . /app
  CMD npm run dev
  EXPOSE 8080  
  </code></pre>
  
  <p>I then create a docker image with <code>docker build -t myproject .</code> and see the image listed via <code>docker images</code></p>
  
  <p>I then run <code>docker run -p 8080:8080 myproject</code> and get a message that my application is running here: localhost:8080   </p>
  
  <p>However, when I either use a browser or Postman to GET localhost:8080 there is no response.</p>
  
  <p>Also, when I run the container from the command line, it appears to lock up so I have to close the terminal.  Not sure if that is related or not though...</p>
  
  <p>UPDATE:
  I trying following the Docker logs such as </p>
  
  <blockquote>
    <p>docker logs --follow </p>
  </blockquote>
  
  <p>and there is nothing other than the last line that my application is running on localhost:8080</p>
  
  <p>This would seem to indicate that my http requests are never making into my container right?</p>
  
  <p>I also tried the suggestion to </p>
  
  <blockquote>
    <p>CMD node_modules/.bin/webpack-dev-server --host 0.0.0.0</p>
  </blockquote>
  
  <p>but that failed to even start.</p>
  
  <p>It occurred to me that perhaps there is a Docker network issue, perhaps resulting in an earlier attempt at kong api learning.  So I run <code>docker network ls</code> and see</p>
  
  <pre><code>NETWORK ID          NAME                DRIVER              SCOPE
  1f11e97987db        bridge              bridge              local
  73e3a7ce36eb        host                host                local
  423ab7feaa3c        none                null                local
  </code></pre>
  
  <p>I have been unable to stop, disconnect or remove any of these networks. I think the 'bridge' might be one Kong created, but it won't let me whack it. There are no other containers running, and I have deleted all images other than the one I am using here.</p>
  
  <p><strong>Answer</strong></p>
  
  <p>It turns out that I had this in my config/index.js:</p>
  
  <pre><code>module.exports = {
    dev: {
      // Various Dev Server settings
      host: 'localhost', 
      port: 8080,
  </code></pre>
  
  <p>Per Joachim Schirrmacher excellent help, I changed host from localhost to 0.0.0.0 and that allowed the container to receive the requests from the host.</p>