1. Create an empty directory on the virtual machine
mkdir rabbitmq
2. Create a new file in the directory
vim docker-compose.yml
The content of the file is as follows:
version: '3'
services:
rabbitmq:
image: rabbitmq:management
container_name: rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=‘username’
- RABBITMQ_DEFAULT_PASS=‘pwd123456’
restart: always
ports:
- 15672:15672
- 5672:5672
logging:
driver: "json-file"
options:
max-size: "500k"
max-file: "10"
volumes:
- ./mqdata:/var/lib/rabbitmq
3. Use the docker-compose command to complete the installation in one step
docker-compose up -d