I'm attempting to expose a react application to the Docker container it currently sits inside.
My Dockerfile successfully builds my image and runs my application on the configured port (8080). I then try to bind port 8080 of the container to port 8080 of the host. However, when I visit the host machine at port 8080 my application is not here.
docker run -d -p 8080:8080 --name react-deployment-container react-deployment:dev
I have an existing node application already exposed on the same host machine running on a different port (3000), so I am confident it is not an issue binding a port when running the Docker container.
I think the issue might be the way I am attempting to expose the application in my Webpack configuration. Webpack builds perfectly but doesn't appear to available to the Docker container.
webpack.config.js
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
host: '0.0.0.0',
port: 8080
}
package.json
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0"
},
I have tinkered with the configuration recommended in the two questions below with no luck.
How to make the webpack dev server run on port 80 and on 0.0.0.0 to make it publicly accessible?
https://github.com/webpack/webpack-dev-server/issues/547
The repo for this project is here