博客列表 >基于 Docker 安装 RabbitMQ

基于 Docker 安装 RabbitMQ

Alfred的学习笔记
Alfred的学习笔记原创
2021年05月10日 11:33:582810浏览

1.先换源

  1. vi /etc/apt/sources.list

更新成下面的源地址

  1. # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
  2. deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
  3. deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
  4. deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
  5. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
  6. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
  7. deb http://mirrors.aliyun.com/ubuntu/ xenial universe
  8. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
  9. deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
  10. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
  11. deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
  12. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
  13. deb http://archive.canonical.com/ubuntu xenial partner
  14. deb-src http://archive.canonical.com/ubuntu xenial partner
  15. deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
  16. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
  17. deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
  18. deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
  19. # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
  20. deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

2.更新源

  1. apt-get update

3.查询RabbitMQ镜像

  1. docker search rabbitmq

3.拉取RabbitMQ镜像

  1. docker pull rabbitmq #(镜像未配有控制台)
  2. docker pull rabbitmq:management #(镜像配有控制台)
  3. #注意:rabbitmq是官方镜像,该镜像不带控制台。如果要安装带控制台的镜像,需要在拉取镜像时附带tag标签,例如:management。tag标签可以通过https://hub.docker.com/_/rabbitmq?tab=tags来查询。
  4. #执行
  5. docker pull rabbitmq:management

4.安装RabbitMQ

  1. docker run --name rabbitmq -d -p 15672:15672 -p 5672:5672 rabbitmq:management

常规操作

  1. #启动 RabbitMQ 容器
  2. docker start rabbitmq
  3. #停止 RabbitMQ 容器
  4. docker stop rabbitmq
  5. #重启 RabbitMQ 容器
  6. docker restart rabbitmq
  7. #查看 RabbitMQ 容器进程信息
  8. docker top rabbitmq
  9. #控制台信息
  10. #启动容器后,可以浏览器中访问http://localhost:15672来查看控制台信息。
  11. #RabbitMQ默认的用户名:guest,密码:guest

问题及解决

  1. #docker stop [CONTAINER ID] 失败,导致 docker rm [CONTAINER ID] 失败
  2. docker rm -f [CONTAINER ID] //强制删除
  3. #再次创建容器但是报错,网络节点被占用
  4. #docker: Error response from daemon: endpoint with name rabbitmq already exists in network bridge.
  5. ps -ef | grep rabbitmq
  6. docker network disconnect --force bridge [rabbitmq 节点名称]
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议