Skip to content

Docker and socket.io connection #163

@istarkov

Description

@istarkov

It looks like impossible when webpack-dev-server started inside docker container to make hot reload work on other computers inside local network.
For example i start docker container and bind container port 3081 to 3081 port on host computer.

docker run -p 3081:3081 ...

and i start webpack-dev-server inside container with arguments

webpack-dev-server --hot --host 0.0.0.0 --port 3081 --inline

i can't use host machine local network ip inside container, so i use 0.0.0.0

And on host machine hot reload works fine, because of client socket connects to ws://0.0.0.0 address, but this not work over local network a la 192.168.0.101

If i create small code change here webpack-dev-server.js#L124 to this line

new Server(webpack(wpOpt), options).listen(options.port, '0.0.0.0', function(err) {

and start dev server as

webpack-dev-server --hot --host $HOST_MACHINE_LOCAL_NET_IP --port 3081 --inline

all works fine on host and local network computers.

So proposal is to add client socket parameter to webpack-dev-server with name like '--client-socket-host', so i can start dev server at host 0.0.0.0 but say client to connect socket to other host address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions