I've spent hours googling this but I can't seem to find the correct pathway/documentation to help me get on the right path :(
The premise is simple.
I have a springboot application that opens on localhost:8080. I have a rabbitmq server that opens on localhost:15672
The springboot application will send messages to the rabbitmq server through some user interaction when both are running. The issue arises when I dockerize(containerize?) both these separate services Now when they are both containerized - I can still access both applications using localhost:8080 and localhost:15672, respectively. But I keep getting a "connection refused" error when my spring boot application submits the user message.
Things I have done to no avail(failure) :
- Both containers, when created, were using the default "bridge" network - didn't work.
- Tried creating my own user defined network, put both containers inside custom network - didn't work
- Created a docker-compose file
version: "3.2" services: rabbitmq: image: rabbitmq:management ports: - "5672:5672" - "15672:15672" networks: - hin-net app-container: image: spring/spring-boot-docker:latest ports: - 8080:8080 environment: - SPRING_RABBITMQ_HOST=rabbitmq depends_on: - rabbitmq networks: hin-net: driver: bridge
The only thing this did was create two docker containers automatically instead of me creating them through "docker run" - This also did not work.
Can anyone help link or provide me some guidance on how I can get my springboot application to see and connect to my rabbitMQ server? Everywhere I looked people said "make sure they're in the same docker network" but that didn't work. I suspect my docker compose file is lacking some important configuration but I'm lost on where I can go for next steps.
These two threads are pretty much my question
- Connect to RabbitMQ in docker-container from another container
- Connect java application in docker container to rabbitmq
but they're dead and a resolution was never found.