根据 dockerhub 中的文档,可以通过修改 /etc/rabbitmq/enabled_plugins 来开启模块,
所以可以将配置文件映射出来,在 docker 启动前上传 enabled_plugins 配置即可方便的开关模块;
测试环境:树莓派-4b UbuntuServer 64-bit
docker-compose.yml
```yml
# 创建目录脚本
# mkdir -p /usr/local/docker/rabbitmq/{data,logs,conf} && chmod -R 777 /usr/local/docker/rabbitmq/ && cd /usr/local/docker/rabbitmq/
#
# docker-compose up -d
# docker-compose down
# docker-compose restart
# 在 conf/enabled_plugins 内添加 模块 rabbitmq_mqtt,rabbitmq_stomp
version: '3'
services:
rabbitmq:
image: arm64v8/rabbitmq:3.8.14-management
restart: always
container_name: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=root
- RABBITMQ_DEFAULT_PASS=root
volumes:
- ./data:/var/lib/rabbitmq
- ./logs:/var/log/rabbitmq/log
- ./conf:/etc/rabbitmq/
ports:
# - 1883:1883 # mqtt
# - 4369:4369 # erlang发现口
- 5672:5672 # java连接端口 amqp
- 15672:15672 # 浏览器连接端口
- 61613:61613 # STOMP 协议接口
# - 25672:25672 # 集群
```
enabled_plugins
```
[rabbitmq_management,rabbitmq_prometheus,rabbitmq_stomp].
```
所以可以将配置文件映射出来,在 docker 启动前上传 enabled_plugins 配置即可方便的开关模块;
测试环境:树莓派-4b UbuntuServer 64-bit
docker-compose.yml
```yml
# 创建目录脚本
# mkdir -p /usr/local/docker/rabbitmq/{data,logs,conf} && chmod -R 777 /usr/local/docker/rabbitmq/ && cd /usr/local/docker/rabbitmq/
#
# docker-compose up -d
# docker-compose down
# docker-compose restart
# 在 conf/enabled_plugins 内添加 模块 rabbitmq_mqtt,rabbitmq_stomp
version: '3'
services:
rabbitmq:
image: arm64v8/rabbitmq:3.8.14-management
restart: always
container_name: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=root
- RABBITMQ_DEFAULT_PASS=root
volumes:
- ./data:/var/lib/rabbitmq
- ./logs:/var/log/rabbitmq/log
- ./conf:/etc/rabbitmq/
ports:
# - 1883:1883 # mqtt
# - 4369:4369 # erlang发现口
- 5672:5672 # java连接端口 amqp
- 15672:15672 # 浏览器连接端口
- 61613:61613 # STOMP 协议接口
# - 25672:25672 # 集群
```
enabled_plugins
```
[rabbitmq_management,rabbitmq_prometheus,rabbitmq_stomp].
```