Install Rabbitmq Docker

Date Published: 23 March 2021

I'm working on a distributed system demo that relies on RabbitMQ for its inter-app messaging. Not wanting to force users to actually have to install RabbitMQ, I'm using Docker to run it. It's really easy to do this. If you've never tried to launch RabbitMQ, complete with its management web app, from a docker command line, try this:

Once you've run that, open up localhost:15672 and you should be looking at the management app (user: guest / password: guest by default). It's magic.

That said, you do still have to remember to run it. If your entire app is configured to run in docker, you can set all of this up using something like docker-compose, and eventually that's my plan here as well. But for now I don't have that set up since I want to be able to run it quickly from Visual Studio or dotnet CLI and building it with docker every time takes longer.

Docker pull rabbitmq: 3-management The image ID is a SHA256 digest covering the image's configuration and layers, and Docker uses a content-addressable image store. For the web application, we will map port 15672 and the message broker port 5672 by using below command. May 26, 2020 Using the RabbitMQ Docker Image. The RabbitMQ container registry includes a variety of images for different platforms.In this article, we will use the RabbitMQ image with a tag 3-management, which is a Docker image with the RabbitMQ management plugin installed and enabled by default.


Install Rabbitmq Docker

Which means I need to remember to run the above command at least once each time I reboot my computer (or kill docker, whichever comes first) before I can run the app(s). This was me, yesterday, remembering this for at least the third time in a week:

> App won't start
Me: WTF? This was working until I rebooted.
> RabbitMQ not running
Me: How can I make this easier?
(spends 20 minutes researching how to add a button to StreamDeck to start RabbitMQ from PowerShell)
Me: Now I have to blog this. What was I doing again?

— Steve 'ardalis' Smith (@ardalis) March 22, 2021

If you read that thread you'll see there are a number of solutions, like running RabbitMQ as an actual Windows service and other things that would probably work. You'll also note that I was serious about that whole blogging about it thing...

But I also have a Stream Deck (affiliate link - thanks for your support) and it has unused buttons staring at me, making me feel guilty. So I figured I'd make a button to run this command. How hard could it be, really?

Well, it turns out there isn't a built-in PowerShell command, so you have jump through more hoops to make it work. It would be great to just put the command into the Stream Deck button setup, but I didn't find a way to do that. So you're basically forced to create a .ps1 file with the script in it.

I did that, and then configured a button with:

But that didn't work for me (though it seems to have worked for others).

It turns out there are good reasons to use a batch file to call your PowerShell file. So I created such a batch file using the sample from this link that basically parameterizes the previous script and calls it.

This actually worked, but it was completely headless. This might be what you want from your Stream Deck button, to execute PowerShell scripts with no UI at all. But in my case I wanted to be able to see the log output of the RabbitMQ process.

Well, you may or may not know that you can add a console UI to your batch file by simply renaming it from .bat to .cmd, as suggested here. Making that small adjustment got me exactly what I wanted - a dedicated button to start RabbitMQ in a new window with log output.

Here's what the final product looks like in my Stream Deck:

And here's the window it produces when pressed:

Setup Rabbitmq Docker

So that's it! If you have a better way to execute arbitrary powershell (or docker) commands from your StreamDeck, please share it in the comments below. Otherwise, I hope this helped you out.

Tags - Browse all tags


Category - Browse all categories

Install Rabbitmq Into Docker

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.

Most Viewed Posts