Cant run webpack-dev-server inside of a docker container?
See original GitHub issueEverything works fine when I want to run this through my local webpack server. I want to pack this project into a docker container.
The main page does get served with all the CSS assets intact, but none of the javascript within seems to have come through. I get this error message on my chrome console:
My Dockerfile looks like this:
FROM node
# Prepare app directory
RUN mkdir -p /usr/src/app
ADD . /usr/src/app
# Install dependencies
WORKDIR /usr/src/app
RUN npm install
# Build the app
RUN npm build
# Expose the app port
EXPOSE "80:3000"
EXPOSE 885
EXPOSE 3001
# Start the app
CMD node build/server.js
Im using docker compose with the following config:
web:
build: .
ports:
- '80:3000'
- '885:885'
- '3001:3001'
command: npm start
Do I need to expose any other ports? Is there a workaround to this?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cannot run webpack-dev-server inside docker - Stack Overflow
I just want to add something to Raphayol answer if you couldn't enable hot-reloading of webpack-dev-server inside container.
Read more >Configure Webpack to work inside a container - Okteto
Configure Webpack to work inside a container. Expose webpack's dev server outside the container. In order to make your app reachable outside the...
Read more >Running WebpackDevServer in Docker - DEV Community
Sometimes we want to run webpack-dev-server in a Docker container. The reason might be like following. Want to use a specific Node.js version ......
Read more >Connection reset with webpack-dev-server inside Docker
The fix is pretty simple, you can either pass in --host 0.0. 0.0 to webpack-dev-server or put in in the aforementioned webpack. config....
Read more >Docker container doesn't publish port as expected when ...
You need to update your webpack-dev-server (in your package.json command and webpack.config.json ) configuration to bind host to 0.0.0.0 instead of localhost ( ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found

can be helpful for somebody: change the binding address to 0.0.0.0
"start": "node_modules/.bin/webpack-dev-server --host 0.0.0.0",orDid you read “Webpack and Docker for Development and Deployment”? It explains the setup quite well.