How to open rabbitmq in browser using docker container?

Olegs Jasjko picture Olegs Jasjko · Nov 14, 2017 · Viewed 56.4k times · Source

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)

Answer

yamenk picture yamenk · Nov 14, 2017

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 lattest 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