Install rabbitmq via docker in OS-X
How to install docker in OS-X
- I have installed docker in my OS-X machine using boot2docker VM
- Following is a detailed article that I have written regarding how docker works with boot2docer - Docker in OSX
Install rabbitmq
Search for rabbitmq
docker search rabbitmq
- Following is the available images for rabbitmq
Pull rabbitmq image
docker pull rabbitmq:latest
This command will pull latest rabbitmq docker image to your computer
-
Things to notice
-
rabbitmq
image name -
latest
tag of the image(latest image)
-
If you download rabbitmq from your own registry(private registry), you have to specifies the registry details with docker pull command
docker pull 10.2.4.201/rabbitmq:latest
-
Things to notice
-
10.2.4.201
defines private registry host -
rabbitmq:latest
defines rabbitmq image name and tag in the registry
-
Now following are my available docker images
- More info on private docker registries - private-registry
Create a container from pulled image
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq 10.2.4.201/rabbitmq
-
Things to notice
-
-p 5672:5672 -p 15672:15672
defines port forwarding -
--name rabbitmq
defines name of the container -
-d
allows to run container as a demon -
10.2.4.201/rabbitmq
defines image name
-
Above command will creates a new docker container with name
rabbitmq
which can runs as a demon
Run rabbitmq
## start boot2docker
boot2docker up
## start rabbitmq container
docker start rabbitmq
Now you can access rabbitmq via
<boot2docker-ip>/15672
In my scenario http://192.168.59.103:15672/
Access rabbitmq from localhost
In above scenario we have to access rabbitmq via boot2docker ip, since docker installed in boot2docker vm
In order to access rabbitmq via localhost, you have to define port-forwarding rules with
VBoxManage
(since I have installed boot2docker VM via oracle virtual box)
## first need to down boot2docker
boot2docker down
## define port forwarding rule for port 15672
VBoxManage modifyvm "boot2docker-vm" --natpf1 "rabbitmq-port-15672,tcp,127.0.0.1,15672,,15672"
## define port forwarding rule for port 5672
VBoxManage modifyvm "boot2docker-vm" --natpf1 "rabbitmq-port-5672,tcp,127.0.0.1,5672,,5672"
## up boot2docker
boot2docker up
## start rabbitmq
docker start rabbitmq
Now you can access rabbitmq via localhost http://localhost:15672/
More info on boot2docker port forwarding and configurations - https://coderwall.com/p/qsr3yq/postgresql-with-docker-on-os-x-docker-postgres-osx
Rabbimq configuration
- When doing rabbitmq configurations you have to connect to rabbitmq container
- Following command allows you to access /bin/bash on running container
docker exec -i -t rabbitmq bash
-
Things to notice
-
exec
execute command -
rabbitmq
container name -
bash
execute bash
-
Now you are inside the rabbitmq container
- You can edit the rabbitmq configuration files to add more configurations
- Following are some rabbitmq config files
/etc/rabbitmq/rabbitmq.config
/etc/rabbitmq/enabled_plugins
- More on rabbitmq configurations - configurations
Rabbimq log files
- Log files are locatest in
/var/log/rabbitmq
- Following are some rabbitmq log files
/var/log/rabbitmq/rabbit\@f8e92f15b87d.log
/var/log/rabbitmq/rabbit@f8e92f15b87d-sasl.log
- More on rabbitmq file locations - file locations
Written by eranga bandara
Related protips
1 Response
Great article. It got me up and running with boot2docker and rabbitmq. I have one question... why do you have two sets of ports.. what is happening when you do -p 5672:5672 -p 15672:15672