How to open rabbitmq in browser using docker container?
You are using the wrong image which doesn't have the rabbitmq_management plugin enabled. Change rabbitmq:latest
to rabbitmq:management
.
On dockerhub they are using the command:
docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3-management
If you want to go to the UI on localhost:15672
make sure to expose the port by adding -p 15672:15672
to the above command.
The management image is just the rabbitmq latest image with the management plugin enabled. Here is the dockerfile for rabbitmq:management
FROM rabbitmqRUN rabbitmq-plugins enable --offline rabbitmq_managementEXPOSE 15671 15672
First off, you need the management image (eg. rabbitmq:3-management
) to access it through the browser. If your docker is running locally, then you should be able to access it by navigating to http://localhost:{port}
or http://127.0.0.1:{port}
(15672
by default).
Here is an example of a simple docker-compose.yml
:
version: "3"services: rabbitmq: image: "rabbitmq:3-management" ports: - "5672:5672" - "15672:15672" volumes: - 'rabbitmq_data:/data'volumes: rabbitmq_data:
After starting the container, Rabbitmq is now accessible at http://127.0.0.1:15672
. The default username and password should be guest:guest
. More details here.
Better to expose all three ports (5672, 5673, 15672).
docker run -d --name some-rabbit -p 5672:5672 -p 5673:5673 -p 15672:15672 rabbitmq:3-management
Then you may browse, http://localhost:15672/ with the credentials "guest" for both the username and the password.