快速安装
docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.8.6-management
docker启动
docker run -d -it --name myrabbitmq -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3.8.6-management
docker-compose.yml
version: '3'
services:
rabbitmq:
image: rabbitmq:management
container_name: myrabbitmq
hostname: myrabbitmq
restart: always
ports:
- 5672:5672
- 15672:15672
volumes:
- /var/docker/rabbitmq/data:/var/lib/rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=123456
说明:
rabbitmq:3.8.6-management:后面带management是带web管理界面的
RABBITMQ_DEFAULT_USER:默认账号和密码是:guest
RABBITMQ_DEFAULT_PASS:设置密码