I recently discovered yjs and it’s very impressive to say the least!
I’m having issues running the y-websocket server via the Dockerfile. It runs fine without docker (by ./bin/server.js, I can visit localhost:1234 and it responds okay).
On starting the docker container, I see the message running at 'localhost' on port 1234, but visiting localhost:1234 gives me localhost didn’t send any data..
Here are my docker commands:
docker build -t yws .
docker run -it --rm -p 1234:1234 --name yws yws
Response from docker:
> y-websocket@1.3.11 start /home/node/app
> node ./bin/server.js
running at 'localhost' on port 1234
(But nothing on localhost:1234)
I’m running docker on mac. I believe I must be missing something about docker networking. But I’m wondering if any of you came across this and happen to have a fix.
I don’t use docker. I hope that somebody else can help you.
If you figure out the issue, it would be great if you could share it (and possibly create a PR to the y-websocket/Dockerfile if that fixes the problem).
You must set ENV HOST=0.0.0.0 in your Dockerfile.
Or you can docker run -it --rm -p 1234:1234 -e HOST=0.0.0.0 --name yws yws.
Node server can not be visitied if this host is localhost or 127.0.0.1 in docker.