Reputation: 21
I have a docker nats-server running in WSL.
docker run -d -p 4222:4222 -p 6222:6222 -p 8222:8222 --name my-nats-container nats:latest
When I run my client on my host machine, it connects fine.
But what if my client is on another device? I'm trying to connect to the http server on port 8222 from the other device and I'm unable to connect to it. Or telnet into with port 4222.
What am I missing to broadcast my nats-server throughout my network?
What ip address should my client use to connect to my nats-server? It should be my host ip.
Expecting to connect to my dockerized nats-server from another machine.
Update: When I run the nats-server.exe (without docker) I connect fine using the ip address of the host. It's when I use it as a docker it does not connect.
Update #2: It seems my WSL has its own IP and my host is another IP. I looked at maybe doing a portproxy to be able to forward any HostIP connects towards a WSL connect. Is there no other way?
Upvotes: 0
Views: 234
Reputation: 793
If your client is in the same network (wifi) as the nats docker host, then you have to use the docker host private ip for nats connection.
Ex:
ipconfig
]Then you your client should be able to connect to docker host without any issues
Upvotes: 0