title: Docker for Mac | Docker Compose | Cannot access containers using localhost
body: <p>I've been trying to figure out why I cannot containers using "localhost:3000" from host. I've tried installing Docker via Homebrew, as well as the Docker for Mac installer. I believe I have the docker-compose file configured correctly. </p>
  
  <p>Here is the output from docker-compose ps</p>
  
  <pre><code>           Name                         Command               State                       Ports
  --------------------------------------------------------------------------------------------------------------------
  ecm-datacontroller_db_1      docker-entrypoint.sh postgres    Up      0.0.0.0:5432-&gt;5432/tcp
  ecm-datacontroller_kafka_1   supervisord -n                   Up      0.0.0.0:2181-&gt;2181/tcp, 0.0.0.0:9092-&gt;9092/tcp
  ecm-datacontroller_redis_1   docker-entrypoint.sh redis ...   Up      0.0.0.0:6379-&gt;6379/tcp
  ecm-datacontroller_web_1     npm start                        Up      0.0.0.0:3000-&gt;3000/tcp
  </code></pre>
  
  <p>Here is my docker-compose.yml</p>
  
  <pre><code>version: '2'
  services:
    web:
      ports:
        - "3000:3000"
      build: .
      command: npm start
      env_file: .env
      depends_on:
        - db
        - redis
        - kafka
      volumes:
        - .:/app/user
    db:
      image: postgres:latest
      ports:
        - "5432:5432"
    redis:
      image: redis:alpine
      ports:
        - "6379:6379"
    kafka:
      image: heroku/kafka
      ports:
        - "2181:2181"
        - "9092:9092"
  </code></pre>
  
  <p>I cannot access any ports that are exposed by docker-compose with <code>curl localhost:3000</code> I get the following result from that</p>
  
  <pre><code>curl: (52) Empty reply from server
  </code></pre>
  
  <p>I should be getting <code>{"hello":"world"}</code>.</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM heroku/heroku:16-build
  
  # Which version of node?
  ENV NODE_ENGINE 10.15.0
  # Locate our binaries
  ENV PATH /app/heroku/node/bin/:/app/user/node_modules/.bin:$PATH
  
  # Create some needed directories
  RUN mkdir -p /app/heroku/node /app/.profile.d
  WORKDIR /app/user
  
  # Install node
  RUN curl -s https://s3pository.heroku.com/node/v$NODE_ENGINE/node-v$NODE_ENGINE-linux-x64.tar.gz | tar --strip-components=1 -xz -C /app/heroku/node
  
  # Export the node path in .profile.d
  RUN echo "export PATH=\"/app/heroku/node/bin:/app/user/node_modules/.bin:\$PATH\"" &gt; /app/.profile.d/nodejs.sh
  
  ADD package.json /app/user/
  RUN /app/heroku/node/bin/npm install
  ADD . /app/user/
  
  EXPOSE 3000
  </code></pre>
  
  <p>Anyone have any ideas?</p>