title: Can't connect to frontend in Dockerized React web app on MacOS
body: <p>I was recently hired on a website development project and I am having trouble deploying it via docker on MacOS. I just can't connect to the frontend via localhost:8000.
  I have temporarily solved this problem by running docker in a virtual machine (Ubuntu), but some things are not working correctly due to this connection.</p>
  <p>What are the ways to solve this problem?</p>
  <p>Here is the config in dockerfiles:</p>
  <p><strong>Dockerfile (frontend)</strong></p>
  <pre><code># pull official base image
  FROM node:12-alpine as build
  
  
  # create and set working directory
  WORKDIR /app
  # install app dependencies
  RUN mkdir frontend
  COPY package.json ./frontend/
  COPY package-lock.json ./frontend/
  COPY frontend_healthchecker.sh ./frontend/
  RUN chmod +x /app/frontend/frontend_healthchecker.sh
  
  RUN ls
  RUN cd frontend &amp;&amp; ls
  RUN cd frontend &amp;&amp; npm install --only=prod
  # RUN cd frontend &amp;&amp; npm install --scripts-prepend-node-path=auto
  
  # add app code
  COPY . ./frontend/
  RUN cd frontend &amp;&amp; ls
  
  # start app
  RUN cd frontend &amp;&amp; npm install &amp;&amp; npm run build
  
  FROM nginx:1.16.0-alpine
  COPY --from=build /app/frontend/build /usr/share/nginx/html
  COPY --from=build /app/frontend/nginx/default.conf /etc/nginx/conf.d/default.conf
  
  COPY --from=build /app/frontend/frontend_healthchecker.sh /home
  RUN chmod +x /home/frontend_healthchecker.sh
  RUN apk add curl
  RUN apk search curl
  HEALTHCHECK CMD [&quot;/bin/sh&quot;, &quot;/home/frontend_healthchecker.sh&quot;]
  
  EXPOSE  8000
  
  CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]
  </code></pre>
  <p><strong>Dockerfile (backend)</strong></p>
  <pre><code>FROM node:12
  ENV TZ=Europe/Moscow
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone
  
  #install ffmpeg
  RUN apt-get -y update
  RUN apt-get -y upgrade
  RUN apt-get install -y ffmpeg
  RUN apt-get install -y mediainfo
  
  RUN apt-get -y update
  RUN apt-get -y upgrade
  RUN apt-get install -y python-pip
  RUN pip --version
  RUN pip install numpy
  RUN pip install opencv-contrib-python
  RUN pip install urllib3
  
  WORKDIR /app
  
  COPY . /app
  COPY backend_healthchecker.sh /app
  RUN chmod +x backend_healthchecker.sh
  
  RUN ls
  RUN npm install
  
  EXPOSE 8080
  
  WORKDIR /app/bin
  
  HEALTHCHECK CMD ../backend_healthchecker.sh
  ENTRYPOINT [&quot;node&quot;]
  
  CMD [&quot;www&quot;]
  </code></pre>
  <p><strong>docker-compose.yaml</strong></p>
  <pre><code>version: '3.3'
  services:
      kurento:
          network_mode: &quot;host&quot;
          build:
              context: ./kurento
          volumes: 
              - &quot;/etc/timezone:/etc/timezone:ro&quot;
              - &quot;/etc/localtime:/etc/localtime:ro&quot;
              - static-content:/tmp
          container_name: p_kurento
          environment:
              - GST_DEBUG=2,Kurento*:5
      mongo:
          network_mode: &quot;host&quot;
          image: mongo:latest
          restart: always
          container_name: p_mongo
          volumes: 
              - &quot;/etc/timezone:/etc/timezone:ro&quot;
              - &quot;/etc/localtime:/etc/localtime:ro&quot;
              - db-content:/data/db
          healthcheck:
              test: mongo localhost:27017/test | mongo show dbs
              interval: 1m
              timeout: 15m
              retries: 5
      backend:
          network_mode: &quot;host&quot;
          env_file:
              - ./backend/.env
          build:
              context: ./backend
          container_name: p_backend
          volumes: 
              - &quot;/etc/timezone:/etc/timezone:ro&quot;
              - &quot;/etc/localtime:/etc/localtime:ro&quot;
              - static-content:/files
      frontend:
          network_mode: &quot;host&quot;
          env_file:
              - ./frontend/.env
          build:
              context: ./frontend
          container_name: p_frontend
          volumes: 
              - &quot;/etc/timezone:/etc/timezone:ro&quot;
              - &quot;/etc/localtime:/etc/localtime:ro&quot;
      coturn:
          network_mode: &quot;host&quot;
          build:
              context: ./stun
          container_name: p_turn
  
      portainer:
          #network_mode: &quot;host&quot;
          restart: always
          image: portainer/portainer
          command: --admin-password=somepassword -H unix:///var/run/docker.sock
          ports:
              - &quot;9000:9000&quot;
          volumes:
              - /var/run/docker.sock:/var/run/docker.sock
          container_name: portainer
  
  volumes:
    static-content:
    db-content:
  </code></pre>