构建“无法在节点上执行操作”时Docker rabbitmq图像错误

问题描述 投票:0回答:1

尝试使用以下命令构建映像时出错:

docker-compose build

错误:

Error

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 dockerfile:

FROM rabbitmq:3-management

MAINTAINER [email protected]

# 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 docker-compose rabbitmq dockerfile rabbitmqctl
1个回答
1
投票

由于我没有发现错误,我以其他方式做到了。

Dockerfile:

FROM rabbitmq:3.6.6-management

MAINTAINER [email protected]

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

我希望这可以帮助你

© www.soinside.com 2019 - 2024. All rights reserved.