尝试使用以下图像构建图像时出现错误:
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 dockerfile:
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
该错误表明该节点未运行,但是在文档中我没有看到有关启动节点的任何信息。在我看过的所有教程中,这都行得通。
谢谢大家
答案 0 :(得分:1)
由于我没有发现错误,所以我选择了另一种方法。
Dockerfile:
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"}]
}
].
希望对您有帮助