Docker构建时rabbitmq镜像错误"Unable to perform operation on node"

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

我在尝试构建映像时遇到错误:

docker-compose build

错误:

docker-compose.yml 文件:

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 docker文件:

FROM rabbitmq:3-management

MAINTAINER victorcf999@gmail.com

# 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

错误说节点不是运行,但我在文档中没有看到任何关于启动节点的内容。在我看过的所有教程中,这应该可行。

谢谢大家

由于没有发现错误,所以我换了个方法。

Docker 文件:

FROM rabbitmq:3.6.6-management

MAINTAINER victorcf999@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"}]
  }
].

希望对您有所帮助