Reputation: 2096
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 path D:\Docker\rabbitmq
, how I supposed to get there? (the path doesn't seems to be recognized)
Upvotes: 136
Views: 181308
Reputation: 499
If you are running docker container on Remote host and unable to access URL - > e.g. http://IPaddress:port/15672 , that means docker is running on its own network and you need to share the host machine network with docker container .
you can use this parameter while running your docker run command
--network host . that will share the network and you will be access to directly access the rabbit management for docker running on remote
Upvotes: -1
Reputation: 1352
Please you need to enable the management plugins, to be able to access its UI and this by running the following command:
docker container exec -it container-name rabbitmq-plugins enable rabbitmq_management
Now you should be able access: http://127.0.0.1:15672/
Upvotes: 2
Reputation: 2495
Mapping the ports will do the trick i.e 8085:15672
docker run -d --hostname rmq --name rabbit-server
-p 8085:15672 -p 5672:5672 rabbitmq:3-management
then go to http://localhost:8085/, to access the management console. Instead of 8085 you can use any port available/open in your machine/server.
Please refer this tuto for more details
Upvotes: 1
Reputation: 476
In the current version (20.10.12), I had to pull the latest management plugin enabled image using:
docker pull rabbitmq:management
Then run with the command (this command does both, pull & run):
docker run -p 15672:15672 -p 5672:5672 --name rabbit-image-name rabbitmq:management
Navigate to: http://localhost:15672/
It worked!
Make sure you stop the other container images before starting this one.
Upvotes: 13
Reputation: 11
FROM rabbitmq:3.8-management
RUN rabbitmq-plugins enable --offline rabbitmq_mqtt rabbitmq_federation_management rabbitmq_stomp
WORKDIR /usr/src/app
ENV RABBITMQ_ERLANG_COOKIE: 'secret cookie here'
VOLUME ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/mnesia/
EXPOSE 5672 15672
Upvotes: 1
Reputation: 558
With Java you may use the lib Testcontainers RabbitMQ Module. An example to bootstrap using Scala:
val rabbitMQContainer = new RabbitMQContainer("rabbitmq:management")
rabbitMQContainer.start()
if (os == "mac os x") Process(s"open ${rabbitMQContainer.getHttpUrl}").!
and then login with guest:guest
Full example: https://github.com/pbernet/akka_streams_tutorial/blob/master/src/main/scala/alpakka/amqp/AmqpEcho.scala
Upvotes: 0
Reputation: 5172
Please try with version 3, also the article below works on me after giving painstaking trials with 3.8
https://blog.devgenius.io/rabbitmq-with-docker-on-windows-in-30-minutes-172e88bb0808
Upvotes: 0
Reputation: 51906
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
Upvotes: 216
Reputation: 21
I use the following command And in that I defined the username and password I also exposed ports 5673 and 15673 You need to enter your username and password
docker run -d --name same-rabbit \
--hostname my-rabbit \
-e RABBITMQ_DEFAULT_USER=USERNAME \
-e RABBITMQ_DEFAULT_PASS=PASSWORD \
-v /home/USER/rabbitmq/:/var/lib/rabbitmq \
-p 5673:5672 \
-p 15673:15672 \
rabbitmq:management
You can also use the following docker compose
version: '3.3'
services:
rabbitmq:
container_name: same-rabbit
environment:
- RABBITMQ_DEFAULT_USER=USERNAME
- RABBITMQ_DEFAULT_PASS=PASSWORD
volumes:
- '/home/USER/rabbitmq/:/var/lib/rabbitmq'
ports:
- '5673:5672'
- '15673:15672'
image: 'rabbitmq:management'
Upvotes: 2
Reputation: 2397
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.
Upvotes: 74
Reputation: 805
Instead of http://localhost:15672 you would want to use the ip that your docker instance is running on. On windows run:
ipconfig
Use the ip address as highlighted below:
Then try http://10.0.75.1:{your-rabbitmq-port}
Upvotes: 4
Reputation: 411
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
Upvotes: 31
Reputation: 2971
I see some useful answer, but none as mentioned how to access the server (rabbitmq) using container's ip-address. For people looking for this solution...
docker inspect
Upvotes: 0
Reputation: 1506
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.
Upvotes: 76
Reputation: 630
The compose would be like
version: '3'
services:
rabbitmq:
image: rabbitmq:management
ports:
- '5672:5672'
- '15672:15672'
volumes:
- rabbitmq_data
Upvotes: 6
Reputation: 3606
In my case I could access the UI of RabbitMQ for several days but some day it suddenly stop working and I can't access it anymore.
After some investigation the source of this problem was found. It was the main service of docker that somehow stopped.
So if you could access the UI and after some time you couldn't, go to your task manager and search for Docker.Service to see if it is running, as you can see in the below picture.
If you don't see it, you should run it manually. In my case I have it on my desktop it is called "Docker for Windows".
Upvotes: 0