I have a react app which is using the webpack dev server. The server proxies into another web api for CRUD. I can use it when running locally but when building the container, the app does not connect.
Webpack config
  devServer: {
    contentBase: resolve(__dirname, 'dist'),
    host: 'localhost',
    port: 3001,
    hot: true,
    open: true,
    inline: true,
    proxy: {
      '/api': {
        target: 'http://localhost:4567/streams',
        secure: false,
        pathRewrite: { '^/api': '' },
        changeOrigin: true,
      },
    },
  },
dockerfile
FROM node:12-alpine
WORKDIR /app
COPY ./package*.json ./
RUN npm ci
COPY . ./
docker-compose
version: '3.7'
services:
  web:
    container_name: fm-admin
    restart: always
    build:
      context: .
    ports:
      - '3001:3001'
    command: npm start
    environment:
      - CHOKIDAR_USEPOLLING=true
    stdin_open: true
Further more, when i swapped the host from localhost to 0.0.0.0, I am getting the following error
[HPM] Error occurred while trying to proxy request  from 0.0.0.0:3001 to http://localhost:4567/streams (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
But the streams api is running.
Hoping i can get some help here.

 
    