title: Unable to run a development build of a React app in a Docker container using node:alpine
body: <p>I have a React app which is based on Facebook's <code>create-react-app</code>. During development I run it on a specific local port (60001). To achieve this I changed the default <code>start</code> script in the <code>scripts</code> part of my <em>package.json</em> to the following:</p>
  
  <pre><code>    "start": "set PORT=60001 &amp;&amp; react-scripts start",
  </code></pre>
  
  <p>I now have a requirement to run this in a Docker container using the same port. In my Dockerfile I have these two stages:</p>
  
  <pre><code>FROM node:alpine as build
  COPY ./package.json /app/package.json
  WORKDIR /app
  RUN npm install
  RUN rm -f .npmrc
  
  FROM build as build-dev
  COPY ./public/ /app/public
  COPY ./src/ /app/src
  EXPOSE 60001
  CMD ["npm", "start"]
  </code></pre>
  
  <p>Notice I'm exposing the port on the container that I expect the npm dev server to bind to. </p>
  
  <p>I build the image as you'd expect, targeting the <code>build-dev</code> Docker stage above.</p>
  
  <pre><code>docker build --target build-dev -t my-app:local
  </code></pre>
  
  <p>I then run the container like this:</p>
  
  <pre><code>docker run -it -p 60001:60001 my-app:local
  </code></pre>
  
  <p>The intention is to bind my local port 60001 to the same port on the container when I expect my dev app  build to be running.</p>
  
  <p>When I do this I see confirmation that npm is running the correct script and that the app has compiled. However, browsing to <a href="http://localhost:60001/" rel="nofollow noreferrer">http://localhost:60001/</a> gives me nothing. Just an <code>ERR_CONNECTION_REFUSED</code>, as if there's nothing there.</p>
  
  <p>I can't see what I'm doing wrong here. Any ideas? I'd hoped I might be able to get some insight from the container logs, but when I run <code>docker logs</code> for this container I just see the react scripts output confirming my app compiled.</p>