Docker rabbitmq image error when building “Unable to perform operation on node”

1,374 views
Skip to first unread message

victo...@gmail.com

unread,
Apr 23, 2019, 2:20:55 PM4/23/19
to rabbitmq-users
I am having an error when trying to build image with:

docker-compose build

Error:

err.png


------------------------------------------------------------------------------------------------
docker-compose.yml file:
-----------------------------------------------------------------------------------------------
version: '3'

services:
  rabbitmq:
    container_name: hrabbitmq
    image: hyperloopupv:rabbitmq
    build: './rabbitmq'    
    ports:
    - "5672:5672"
    - "15672:15672"
    hostname: hypernode
    tty: true
    volumes:
      - rabbit1:/var/lib/rabbitmq
      - ./conf/:/etc/rabbitmq/
    command:  bash -c "sleep 10; rabbitmq-server;"
    environment:
      - RABBITMQ_USERNAME=guest
      - RABBITMQ_PASSWORD=guest
      - RABBITMQ_NODE_NAME=rabbit@hypernode

------------------------------------------------------------------------------------------
Rabbitmq dockerfile:
-------------------------------------------------------------------------------------------

FROM rabbitmq:3-management


# APT update, wget and sudo
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install apt-utils -y
RUN apt-get install wget -y
RUN apt-get install sudo -y
RUN apt-get install apt-transport-https ca-certificates -y

#Rabbitmq status
RUN rabbitmqctl status

#Set user
RUN rabbitmqctl add_user hyper hyperpass
RUN rabbitmqctl set_user_tags hyper administrator
RUN rabbitmqctl set_permissions -p / hyper ".*" ".*" ".*"

#Eneable management console
RUN rabbitmq-plugins enable rabbitmq_management
RUN sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

WORKDIR ~

# Expose ports.
EXPOSE 5672 15672

------------------------------------------------------------------------
The error says that the node is not running, but I have not seen anything about starting a node in the documentation. In all the tutorial I looked at this should work.

Thanks everyone

Daniil Fedotov

unread,
Apr 23, 2019, 2:45:39 PM4/23/19
to rabbitmq-users
Hi,

The error says that the rabbitmq node is not running.
This may be caused by `sleep 10;` in the docker compose command. I'm not sure why this sleep is there but you can try to remove it or go around it somehow.
By the way, there is a way to specify a different default user and password using environment variables, if that's what you're trying to do.
Also management plugin is supposed to be enabled if you use the 3-management image.

Hope this helps.

victo...@gmail.com

unread,
Apr 23, 2019, 3:15:21 PM4/23/19
to rabbitmq-users
Hi Daniil,

- The sleep 10 and the eneable management plugin was something I forgot to remove, thanks for that.

- I am not trying to specify default users, I am trying to create new ones after rabbitmq is install and started in the container.

- This is my latest version, but the result is the same and now I start rabbitmq manually

dockerfile:
FROM rabbitmq:3-management


# APT update, wget and sudo
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install apt-utils -y
RUN apt-get install wget -y
RUN apt-get install sudo -y
RUN apt-get install apt-transport-https ca-certificates -y

#Rabbitmq status
RUN rabbitmq-server &
RUN rabbitmqctl status

#Set user
RUN rabbitmqctl add_user hyper hyperpass
RUN rabbitmqctl set_user_tags hyper administrator
RUN rabbitmqctl set_permissions -p / hyper ".*" ".*" ".*"

WORKDIR /

# Expose ports.
EXPOSE 5672 15672 1337 1338

Thank you very much!!

Michael Klishin

unread,
Apr 23, 2019, 4:06:46 PM4/23/19
to rabbitmq-users
Your code races with RabbitMQ startup.
Use `rabbitmqctl await_startup --timeout <seconds>` or `rabbitmqctl await_cluster_nodes <count> --timeout <seconds>` or [2] to await for node startup.

See server logs to get some details on the timing of node startup.

A better way to preconfigure a node is via definition import [1].

--
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-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
MK

Staff Software Engineer, Pivotal/RabbitMQ

victo...@gmail.com

unread,
Apr 23, 2019, 4:33:01 PM4/23/19
to rabbitmq-users
Hi Michael,

I have tried that but...

err2.PNG

I can not run that command also so I think the problem may be other, maybe due to some restrictions in the rabbitmq image

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitm...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

victo...@gmail.com

unread,
Apr 23, 2019, 4:42:08 PM4/23/19
to rabbitmq-users
I hope you can see the image, opening it in a new tab and making zoom, if you can not I will write it.

I do not know if this is normal but if I do not start rabbitmq-server in background(line 13), rabbitmq start well but the image never finish building. Is this normal?

err3.PNG

Daniil Fedotov

unread,
Apr 23, 2019, 5:05:41 PM4/23/19
to rabbitmq-users

It appears that rabbitmq-server runs in foreground. You can run it in background and use $! to access its pid and wait for it using 'rabbitmqctl wait' command:

This command should do the trick:
rabbitmq-server & rabbitmqctl wait --pid $!

Victor

unread,
Apr 23, 2019, 5:12:27 PM4/23/19
to rabbitm...@googlegroups.com
I run it in background, I have only ran it in foreground once(my previous post) just to show you that the rabbitmq-server command never ends. It stays forever as shown in the previous snippet.

Thanks for the help

You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/I60yZsJ3iUo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.

Michael Klishin

unread,
Apr 24, 2019, 3:07:10 AM4/24/19
to rabbitmq-users
The message says that the node is not running. It can take more than 30 seconds for a node with existing data directory to start.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Apr 24, 2019, 3:08:18 AM4/24/19
to rabbitmq-users
I highly recommend inspecting server logs over guessing. If a node fails to start because e.g. its critically important paths
are not configured or not readable/writeable (such as the node's data directory), it cannot possibly start and thus await_startup cannot
possibly return successfully.

Guessing is very expensive. Collect data instead.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

victo...@gmail.com

unread,
Apr 24, 2019, 8:00:19 AM4/24/19
to rabbitmq-users

As I did not found the error, I made it the other way you told me.


Dockerfile:


FROM rabbitmq:3.6.6-management

MAINTAINER victo...@gmail.com

ADD rabbitmq.config /etc/rabbitmq/

RUN chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.config
CMD ["rabbitmq-server"]


rabbitmq.config:


[
  {rabbit,
    [
        {default_vhost,<<"/">>},
        {default_user,<<"hyper">>},
        {default_pass,<<"hyperpass">>},
        {default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
        {default_user_tags, [administrator]}
    ]
  },
  {rabbitmq_management,
    [{listener, [{port, 15672}]},
        {http_log_dir, "/var/log/rabbitmq/management_http.log"}]
  }
].

I hope this helps others
Thank you Daniil and Michael (:

Michael Klishin

unread,
Apr 24, 2019, 8:02:09 AM4/24/19
to rabbitmq-users
I'm not 100% sure what specifically you did and it is a true shame that you have to use a version with known issues (3.6.6) from November 2016
but thank you for reporting back to the list :)

--
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-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages