Skip to content

Instantly share code, notes, and snippets.

@fenying
Last active October 23, 2023 02:20
Show Gist options
  • Save fenying/98bbb5b40b713b44d94c061821a2db91 to your computer and use it in GitHub Desktop.
Save fenying/98bbb5b40b713b44d94c061821a2db91 to your computer and use it in GitHub Desktop.
Deploy RabbitMQ server with docker.
MQ_DOCKER_PORT=5672
MQ_DOCKER_ADMIN_USER="user"
MQ_DOCKER_ADMIN_PASS="password"
MQ_DOCKER_ADMINCP_PORT=15672
MQ_DOCKER_PATH=/var/lib/rabbitmq
MQ_DOCKER_NAME="RabbitMQ-Server"
MQ_DOCKER_MEMORY=256M
MQ_LOCAL_PATH=/docker/rabbitmq
MQ_LOCAL_HOST=0.0.0.0
MQ_LOCAL_PORT=5672
MQ_LOCAL_ADMINCP_HOST=127.0.0.1
MQ_LOCAL_ADMINCP_PORT=15672
MQ_HOSTNAME=my-mq-test # Use for the database name, never change after created
docker run \
-d \
--name "$MQ_DOCKER_NAME" \
-m $MQ_DOCKER_MEMORY \
--hostname "$MQ_HOSTNAME" \
-v $MQ_LOCAL_PATH:$MQ_DOCKER_PATH \
-p $MQ_LOCAL_HOST:$MQ_LOCAL_PORT:$MQ_DOCKER_PORT \
-p $MQ_LOCAL_ADMINCP_HOST:$MQ_LOCAL_ADMINCP_PORT:$MQ_DOCKER_ADMINCP_PORT \
-e RABBITMQ_DEFAULT_USER="$MQ_DOCKER_ADMIN_USER" \
-e RABBITMQ_DEFAULT_PASS="$MQ_DOCKER_ADMIN_PASS" \
rabbitmq:management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment