-
Describe the bugI have a docker container running on a linux host. When running the sample .net 8.0 code, I am unable to get past the point of creating a producer. When I run that code, I am getting the following error: First, here is my docker compose: After my container spins up, I am enabling the streams plugin which gives me a message that it's successful: So far so good... Just to be sure, I am gonna test those ports from Windows 11 Powershell to the Linux box: Now I am verifying that everything works. Here is the management page for queues: Yep. We're good. Now I'm running the example code: So even though we get the error, a stream is created on the server. I just couldn't create the Producer and send the message.
My problem is very similar to this one but I have made sure that all machines and containers only have IPV4 enabled Reproduction steps
Expected behaviorNo error in example code, Stream and Message should be created. Additional contextI realize that the example is centered around connecting to a RabbitMQ instance on the same machine. But I need this to run on a DEV server and it's a reasonable expectation that RabbitMQ does not run on your laptop in PROD. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
|
@Gsantomaggio I don't have the permission here to convert this to a discussion. Related discussion in @adammckay - how are you running RabbitMQ's docker container? WSL? I ask because, on my Windows 11 laptop, when I run RabbitMQ via docker in WSL2, it only listens on localhost: > netstat -an|rg 5552
TCP 127.0.0.1:5552 0.0.0.0:0 LISTENING
TCP [::1]:5552 [::]:0 LISTENINGI realize your If I start RabbitMQ on Windows, via the PS functions I shared here, I can connect using your code. Finally, I would try the following. Run this command: It should output Finally, you could also change your code to use the hostname instead of an IP. Let us know if that resolves your issue. |
Beta Was this translation helpful? Give feedback.
-
|
First, thank you for your response. To answer your question, I am running the container on a separate physical Arch Linux box. Whether I run the container using host network or it's own network makes no difference. From within the container, I am able to ping out to the internet, see things on the host network, etc. I did go down the same avenue of thought that you mentioned. I tried the container with some different advertized_host values: These both actually caused the container to run in a bad state. I will dig up the errors from that later today. What makes me wonder about all of this is why does the example code successfully create a stream but then it can't create the producer. Clearly, the IPs and Ports are fine up to the point of creating the stream or you wouldn't see it in the screenshot. Why then are the host ports problematic at the point of creating the Producer? |
Beta Was this translation helpful? Give feedback.
-
|
OK. Here's what happens when I change the advertised_host in my docker compose:
I completely rebuilt the container and made sure no remnants from the prior volume. The container starts fine - enabling the stream plugin: Gets me this error: And of course my code faults because no enpoints can be found. I also tried just using the hostname.
Same error. But yet in the web interface, it names the node rabbit@mylinuxserversname either way. So now I set everything back. Earlier, you had mentioned a 'locator connection'? I am hoping you mean the connection tab in the web ui. (192.168.1.101 is the IP of the Windows machine where I am running the .NET example. 192.168.1.100 is the IP of my Linux Server that hosts docker) |
Beta Was this translation helpful? Give feedback.
-
|
You got me in the right direction. For anyone else running into the same thing, the 'advertised_host' must be set with quotes around the ip address in docker compose. So this is what you do when you are doing everything on your local machine: If you want to specify an IP, DO NOT do this: If you want to specify an IP, you must do this: In my defense, I didn't find any resources to really tell me that. Anyways, thanks a lot #Gsantomaggio! |
Beta Was this translation helpful? Give feedback.



You got me in the right direction. For anyone else running into the same thing, the 'advertised_host' must be set with quotes around the ip address in docker compose.
So this is what you do when you are doing everything on your local machine:
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbitmq_stream advertised_host localhost advertised_port 5552"If you want to specify an IP, DO NOT do this:
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbitmq_stream advertised_host 192.168.1.100 advertised_port 5552"If you want to specify an IP, you must do this:
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbitmq_stream advertised_host '192.168.1.100' advertised_port 5552"In my defense, I didn't find any resource…