uqp34w
Last Updated: April 18, 2016
·
7.826K
· itseranga
892414 10151468467596730 1847316210 o

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

Picture

Pull rabbitmq image

docker pull rabbitmq:latest
  • This command will pull latest rabbitmq docker image to your computer

  • Things to notice

    1. rabbitmq image name
    2. 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

    1. 10.2.4.201 defines private registry host
    2. rabbitmq:latest defines rabbitmq image name and tag in the registry
  • Now following are my available docker images

Picture

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

    1. -p 5672:5672 -p 15672:15672 defines port forwarding
    2. --name rabbitmq defines name of the container
    3. -d allows to run container as a demon
    4. 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

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

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

    1. exec execute command
    2. rabbitmq container name
    3. bash execute bash
  • Now you are inside the rabbitmq container

Picture

  • 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

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

Picture

Say Thanks
Respond

1 Response
Add your response

22665
None

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

over 1 year ago ·
Filed Under