RabbitMQ and docker-compose

1,014 views
Skip to first unread message

Tianxiang Xiong

unread,
Feb 14, 2017, 2:11:18 PM2/14/17
to rabbitmq-users
I have a Dockefile for RabbitMQ as follows:

FROM rabbitmq:3.6.2-management

# RabbitMQ configs
ADD resources
/rabbitmq/rabbitmq.config /etc/rabbitmq/
ADD resources
/rabbitmq/definitions.json /etc/rabbitmq/

# rabbitmqadmin
RUN apt
-get update && apt-get install -y python
ADD https
://raw.githubusercontent.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_2/bin/rabbitmqadmin /usr/bin/rabbitmqadmin
RUN chmod u
+x /usr/bin/rabbitmqadmin

CMD
["rabbitmq-server"]

I also have a docker-compose file as follows:

version: '2'
services
:
  rabbitmq
:
    build
:
      context
: .
      dockerfile
: docker/Dockerfile_rabbitmq.yml
    expose
:
     
- 5672
     
- 15672
     
  rabbitmq
-tools:
    build
:
      context
: .
      dockerfile
: docker/Dockerfile_rabbitmq.yml
    depends_on
:
     
- rabbitmq
    environment
:
     
- RABBITMQ_HOST=rabbitmq
     
- RABBITMQ_PORT=5672
     
- RABBITMQ_USERNAME=guest
     
- RABBITMQ_PASSWORD=guest
     
- RABBITMQ_VHOST=/
      - RABBITMQ_USE_SSL=false
    working_dir: /
usr/src/app
    entrypoint
: /bin/bash

The rabbitmq.config file is as follows:

[
 
{rabbit, [
           
{loopback_users, []},
           
{password_hashing_module, rabbit_password_hashing_md5},
           
{tcp_listeners, [5672]}
         
]},
 
{rabbitmq_management, [
                       
{ listener, [
                                     
{ port, 15672 },
                                     
{ ssl, false }
                                   
]
                       
},
                       
{load_definitions, "/etc/rabbitmq/definitions.json"}
                       
]}
].


The definitions.json file is as follows, with the password has redacted and app name changed to my-app:

{
 
"rabbit_version": "3.6.2",
 
"users": [
   
{
     
"name": "guest",
     
"password_hash": "<hash>",
     
"tags": "administrator"
   
}
 
],
 
"vhosts": [
   
{
     
"name": "/"
   
}
 
],
 
"permissions": [
   
{
     
"user": "guest",
     
"vhost": "/",
     
"configure": ".*",
     
"write": ".*",
     
"read": ".*"
   
}
 
],
 
"parameters": [],
 
"policies": [],
 
"queues": [
   
{
     
"name": "default",
     
"vhost": "/",
     
"durable": true,
     
"auto_delete": false,
     
"arguments": {}
   
},
   
{
     
"name": "my-app.placeholder_consumer",
     
"vhost": "/",
     
"durable": true,
     
"auto_delete": false,
     
"arguments": {}
   
}
 
],
 
"exchanges": [
   
{
     
"name": "standard",
     
"vhost": "/",
     
"type": "topic",
     
"durable": true,
     
"auto_delete": false,
     
"internal": false,
     
"arguments": {}
   
}
 
],
 
"bindings": [
   
{
     
"source": "standard",
     
"vhost": "/",
     
"destination": "my-app.placeholder_consumer",
     
"destination_type": "queue",
     
"routing_key": "my-app.placeholder",
     
"arguments": {}
   
}
 
]
}


After doing docker-compose up -d, I can drop down into the rabbitmq container and use rabbitmqctl status to see that the node is up. When I docker-compse run rabbitmq-tools and run rabbitmqctl -n rabbit@rabbitmq status, however, I get:

Status of node rabbit@rabbitmq ...
Error: unable to connect to node rabbit@rabbitmq: nodedown

DIAGNOSTICS
===========

attempted to contact
: [rabbit@rabbitmq]

rabbit@rabbitmq
:
 
* connected to epmd (port 4369) on rabbitmq
 
* epmd reports node 'rabbit' running on port 25672
 
* TCP connection succeeded but Erlang distribution failed
 
* suggestion: hostname mismatch?
 
* suggestion: is the cookie set correctly?
 
* suggestion: is the Erlang distribution using TLS?

current node details
:
- node name: 'rabbitmq-cli-17@0a0f25e326dd'
- home dir: /var/lib/rabbitmq
- cookie hash: <some hash>


I'm don't think there's a hostname mismatch issue here, and the RabbitMQ image should be using TLS, right? So I guess it might be a cookie issue? I'd like some advice on debugging this.

Michael Klishin

unread,
Feb 14, 2017, 2:33:23 PM2/14/17
to rabbitm...@googlegroups.com
It is a cookie or hostname mismatch 99% of the time.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages