docker 部署 RabbitMQ

docker-compose.yml
version: "3.7"

services:
  rabbitmq:
    image: rabbitmq:alpine
    restart: always
    environment:
      # default username/password: guest / guest
      RABBITMQ_DEFAULT_USER: "rabbitmq"
      RABBITMQ_DEFAULT_PASS: "123456"
      # RABBITMQ_DEFAULT_VHOST: "RabbitMq"
    ports:
      # 5672 client端通信端口
      # 15672 管理界面ui端口。管理插件默认关闭,如要打开,则需要进入容器内运行 rabbitmq-plugins enable rabbitmq_management
      # 管理端也可以单独启动 rabbitmq:management-alpine 镜像
      - "5672:5672"
      - "15672:15672"
      # 1883 mqtt通信端口。mqtt插件默认关闭,如要打开,则需要进入容器内运行 rabbitmq-plugins enable rabbitmq_mqtt
      - "1883:1883"
    volumes:
      - rabbitmq_data:/var/lib/rabbitmq

volumes:
  rabbitmq_data: