How to open rabbitmq in browser using docker container?
Solution 1
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 rabbitmq
RUN rabbitmq-plugins enable --offline rabbitmq_management
EXPOSE 15671 15672
Solution 2
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.
Solution 3
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.
Solution 4
if you launched rabbitmq by using somthing like:
docker run -d --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
then you can enable its management plugins while that container runs using the following command:
docker container exec -it some-rabbit rabbitmq-plugins enable rabbitmq_management
and the management GUI is running on http://localhost:15672 For management GUI
username: guest
password: guest
Solution 5
The compose would be like
version: '3'
services:
rabbitmq:
image: rabbitmq:management
ports:
- '5672:5672'
- '15672:15672'
volumes:
- rabbitmq_data
Olegs Jasjko
Updated on July 08, 2022Comments
-
Olegs Jasjko almost 2 years
This was probably asked already, but so far I can't find any detailed explanation at all, and the existing documentation seems as if it was written for some kind on psychic who supposed to know everything.
As per this manual, I added the container
docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:latest
Then I checked it to receive the container ip
docker inspect some-rabbit
Checked ports with
docker ps
And tried to connect in the browser with this formula
https://{container-ip}:{port}
It did't work.
Am I'm doing something wrong, or maybe I am supposed to add something additional, like a container for apache or other stuff?
EDIT
As I understand, after creating some-rabbit container, now I need to run Dockerfile to create image? (This whole thing is confusing to me). How am I supposed to do that? I mean, I saw command
docker build -f /path/to/a/Dockerfile
but if for example I placed the Dockerfile in second pathD:\Docker\rabbitmq
, how I supposed to get there? (the path doesn't seems to be recognized) -
Olegs Jasjko over 6 yearsStill unclear with the Dockerfile, how I supposed to run it at all? I mean, it supposed to be
docker build -f [path]
but for example I placed it in D:\Docker\rabbitmq\ and here Dockerfile. It seems that I am unable to find it -
yamenk over 6 years@OlegsJasjko Don't build the dockerfile. I just posted it to show you the difference between the
rabbitmq
image andrabbitmq:management
image. If you want to access UI, just runrabbitmq:3-management
instead ofrabbitmq:3-latest
. The management image is already built on dockerhub -
Olegs Jasjko over 6 yearsHm, then I still have a problem. I removed previous container, added new one with -management. Checked if it is started and tried to open localhost:15672 (default port as I understand) and nope, nothing happened, can't open this link
-
yamenk over 6 years@OlegsJasjko If you want to use
localhost
make sure to expose the port by adding-p 15672:15672
, then you can connect tolocalhost:15672
. Otherwise, use<container-ip>:15672
-
Olegs Jasjko over 6 yearsRecreated container with port (is there a way to add port to existing one?) and yep, now it works on localhost:15672. But for some reason, it didn't worked with container-ip, could you please add to yours answer words about port? (will accept it anyway, but still it will be more full then)
-
Gonçalo over 5 yearsThis is not a dockerfile... it's a docker-compose file and the format is not correct.
-
John Hunt almost 4 yearsThis worked for me although I had to use localhost rather than 127.0.0.1
-
Iman almost 3 yearsmaybe management plugin is not enable in your container. so just do this command:
docker exec [CONTAINER_NAME] rabbitmq-plugins enable rabbitmq_management