title: How to access create-react-app run in a docker container?
body: <p>I followed the steps under <a href="https://mherman.org/blog/dockerizing-a-react-app/" rel="nofollow noreferrer">https://mherman.org/blog/dockerizing-a-react-app/</a></p>
  
  <p>My setup:</p>
  
  <ul>
  <li>Windows 10 Home</li>
  <li>docker commands are run in the Docker Quickstart Terminal <a href="https://docs.docker.com/toolbox/toolbox_install_windows/" rel="nofollow noreferrer">https://docs.docker.com/toolbox/toolbox_install_windows/</a></li>
  </ul>
  
  <p>How to reproduce: Follow the steps from the first link:</p>
  
  <p>install create-react-app globally:</p>
  
  <pre><code>npm install -g create-react-app@3.4.1
  </code></pre>
  
  <p>Generate new app:</p>
  
  <pre><code>$ npm init react-app sample --use-npm
  $ cd sample
  </code></pre>
  
  <p>Create Dockerfile in the root of directory:</p>
  
  <pre><code># pull official base image
  FROM node:13.12.0-alpine
  
  # set working directory
  WORKDIR /app
  
  # add `/app/node_modules/.bin` to $PATH
  ENV PATH /app/node_modules/.bin:$PATH
  
  # install app dependencies
  COPY package.json ./
  COPY package-lock.json ./
  RUN npm install --silent
  RUN npm install react-scripts@3.4.1 -g --silent
  
  # add app
  COPY . ./
  
  # start app
  CMD ["npm", "start"]
  </code></pre>
  
  <p>Add .dockerignore:</p>
  
  <pre><code>node_modules
  build
  .dockerignore
  Dockerfile
  Dockerfile.prod
  </code></pre>
  
  <p>Build and tag the dockerimage:</p>
  
  <pre><code>$ docker build -t sample:dev .
  </code></pre>
  
  <p>Spin up the container:</p>
  
  <pre><code>$ docker run \
      -it \
      --rm \
      -v ${PWD}:/app \
      -v /app/node_modules \
      -p 3001:3000 \
      -e CHOKIDAR_USEPOLLING=true \
      sample:dev
  </code></pre>
  
  <p>This is what I see in the Docker Quickstart Terminal:
  <a href="https://i.stack.imgur.com/TDWp9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TDWp9.png" alt="enter image description here"></a></p>
  
  <p>And this is my project structure:
  <a href="https://i.stack.imgur.com/ySgZH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ySgZH.png" alt="enter image description here"></a></p>
  
  <p>However, when I go to localhost:3001 as described in the post, I see 
  <a href="https://i.stack.imgur.com/4GOyT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4GOyT.png" alt="enter image description here"></a></p>
  
  <p>Any idea where I'm missing something?</p>