Replies: 2 comments 3 replies
-
@oheckmann did you use the |
Beta Was this translation helpful? Give feedback.
2 replies
-
btw what is the environment that you are running this on? above should just work on a linux env but there might be other docker networking quirks on Windows |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The is probably an obvious mistake, but I have been banging my head on it for several days. For a project I have a Go Server running in a Docker container, a NATs Server, and a standalone client.
The server tries to send messages through NATs. To connect to NATs, it uses the following code:
But when I try to run the server, I get an error which causes the program and container to stop:
panic: nats: no servers available for connection
. This seems to mean that the program Server in the container cannot find the NATs that is running.Both Windows-server and NATs are running in the same Docker Network.
And when I enter into the Container and use telnet to access Nats at the port nats:4222, telnet finds the NATs server correctly
I have already tried to change the URL that
nats.Connect
is connecting to, and none of them have worked. I have tried"nats"
and"nats:4222"
and"nats://nats:4222"
, and the NATs URLs as well. I do not know what I am doing incorrectly.The Dockerfile of the Container looks like this:
I set up NATs with the command
docker run -d --rm --name nats --network=mybridge -p 4222:4222 nats
, the server withdocker run -d --name windows-server --network=mybridge -p 50051:50051 windows-server
The Server works correctly when it is running outside of a container. What do I need to change so that the Go server can access Nats?
Beta Was this translation helpful? Give feedback.
All reactions