Node.js – Docker React App: 404s will fallback to /

dockernode.jsnpmreactjs

I am building an React Javascript App with npm and want to deploy it on docker.
When I run the App locally with:

npm start

It all works just fine.
But then when I build a Docker Image and test it I get follwing error:

$ docker run react-app

> keycloak-react@0.1.0 start /
> react-scripts start

ℹ 「wds」: Project is running at http://172.17.0.2/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

The Dockerfile looks like:

FROM node:latest
COPY ./keycloak-react .
RUN npm install typescript
RUN npm install node-sass
RUN npm install sass
RUN npm install fibers
RUN npm install
EXPOSE 3000
CMD [ "npm", "start", "run", "--host", "0.0.0.0"]

I don't know what to do any ideas ?

Best Answer

I just fixed, let add stdin_open: true to docker-compose to fix it.

link info: https://github.com/facebook/create-react-app/issues/8688