Docker Community Forums

Share and learn in the Docker community.

Communicate between apps in containers


(Jereesh) #1

I have created two spring boot applications and made a container for each of them. I also have a rabbitmq container running. I have exposed the rabbitmq container to the an external port as well(mapped docker port 5672 to 32781). Both of my spring boot applications need to communicate with this rabbitmq. If I run these applications outside docker ie the applications are run directly on my machine and communicate with the rabbitmq which is running inside the container everything works . ie the applications can connect to the rabbitmq using the exposed port. But when I use the containerized spring boot applications the connection is getting refused . I tried both the port (5672 and 32781) . I have made all three containers in the same bridge network as well . What is the solution?. I am using Docker for Windows (on Windows 10)


(Think) #2

they do have their own network.
So they should not connect to localhost:5672 and localhost:32781, but instead to rabbitmq:5672 (here the not exposed port number)


(Jereesh) #3

I have tried that as well . I have even inspected the IP address of the containers using Docker network inspect command and tried that IP as well .