title: How to send HTTP requests to my docker container from localhost?
body: <p>I'm having trouble making HTTP requests to my docker container (it's a Node.js API that communicates with a Redis database), which runs inside a VM (Docker Toolbox).</p>
  
  <p>I've set up my Dockerfile and docker-compose.yml with the desired ports. Built them and ran ("up") them successfully.</p>
  
  <pre><code>FROM node:8.15
  
  WORKDIR /redis_server
  
  COPY package.json package-lock.json ./
  
  RUN npm install
  
  COPY . ./
  
  EXPOSE 8080
  
  CMD ["npm", "start"]
  </code></pre>
  
  <pre><code>version: '3'
  services:
    web:
      build: .
      depends_on:
        - db
  
    db:
      image: redis
      ports:
        - "6379:6379"
  </code></pre>
  
  <p>redis.js</p>
  
  <pre class="lang-js prettyprint-override"><code>const PORT = 6379
  const HOST = 'db'
  </code></pre>
  
  <p>server.js (express.js)</p>
  
  <pre class="lang-js prettyprint-override"><code>const PORT = '0.0.0.0:8080'
  </code></pre>
  
  <p>I build the container succesfully, then use a HTTP request service to test a GET. Since I run Docker Toolbox and that the VM is on host 192.168.99.100, I send my requests to <a href="http://192.168.99.100:8080" rel="nofollow noreferrer">http://192.168.99.100:8080</a>.</p>
  
  <p>This does not work, the error message that appears in my Visual Studio Code is "Connection is being rejected. The service isn't running on the server, or incorrecte proxy settings in vscode, or a firewall is blocking requests. Details: Error: connect ECONNREFUSED 192.168.99.100:8080."</p>
  
  <p>Not sure where to go from here. I don't consider myself knowledgeable on things network.</p>