尝试使用以下命令构建映像时出错:
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 [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
该错误表明该节点未运行,但我还没有看到有关在文档中启动节点的任何信息。在所有教程中,我看到这应该工作。
感谢大家
由于我没有发现错误,我以其他方式做到了。
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"}]
}
].
我希望这可以帮助你