I'm trying to run docker on Windows 10 (Linux Containers Mode) to run react development workspace. I managed to run React app boilerplate but livereloading is not working.
Here's some details:
docker exec
and create-react-app .
commandsFROM node:latest
#installing react app first
RUN npm install -g create-react-app
VOLUME [ "/application" ]
#First example was EXPOSE 3000 35729
EXPOSE 3000
EXPOSE 35729
Build command: docker build . -t react-image
Run command: docker run -d -p 3000:3000 -p 35729:35729 -v %PATH_TO_APP_FOLDER%\application:/application --name react-container react-image
Exec command: docker exec -it react-container bash
Then inside the container:
cd application
create-react-app .
yarn start
Compiled successfully!
You can now view application in the browser.
Local: http://localhost:3000/ On Your Network: http://172.17.0.2:3000/
Note that the development build is not optimized. To create a production build, use yarn build.
Once I open: http://localhost:3000 everything seems to work fine. If I change files from my host machine files are also changed inside the container (checked with cat App.js
). But changing files doesn't trigger webpack re-compiling and livereload.
Any suggestions?
Please let me know if I need to provide more details. Thanks
This can be solved by setting watchOptions.poll
to true inside the webpack config:
References
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