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
> [email protected] 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 ?
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
I added -i -t
flags in the docker run
command and it worked fine for me
-i
leaves the stdin of the container opened
-t
assigns a pseudo-tty
(for interactive session with shell)
My command was:
docker container run -i -t image_name
I think
docker run -i -t image_name
will work as well (don't know the real difference between the 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With