Connecting webpack-dev-server inside a Docker container from the host

前端 未结 2 1615
抹茶落季
抹茶落季 2020-12-14 09:54

I\'m running a webpack-dev-server application inside a Docker container (node:4.2.1). If I try to connect to the server port from within the container - it works fine. Howev

相关标签:
2条回答
  • 2020-12-14 10:41

    This issue is not a docker problem.

    Add --host=0.0.0.0 to your webpack command.

    You need to connect to your page like this:

    http://host:port/webpack-dev-server/index.html

    Look to the iframe mode

    0 讨论(0)
  • 2020-12-14 10:47

    You need to make sure:

    • you docker container has mapped the EXPOSE'd port to a host port

      docker run -p x:y 
      
    • your VM (if you are using docker machine with a VM) has forwarded that mapped port to the actual host (the host of the VM).
      See "How to access tomcat running in docker container from browser?"

    0 讨论(0)
提交回复
热议问题