docker run --hostname my-rabbit --name my-rabbit -p 5671:5671 -p 15671:15671 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=abc -e RABBITMQ_DEFAULT_PASS=abc -d rabbitmq:4.0-management
-
使用docker的复制命令将ca.crt、server.crt和server.key文件复制到容器的/etc/server_ssl目录下(其实复制到哪都行,就是后面配置文件写的对应的文件路径)
-
在容器的/etc/rabbitmq/rabbitmq.conf文件中写下面的内容(如果没有该文件就自己创建一个),最好的方法是在宿主机创建一个rabbitmq.conf写好下面的内容,然后复制到容器的/etc/rabbitmq/rabbitmq.conf
listeners.ssl.default = 5671
ssl_options.cacertfile = /etc/server_ssl/ca.crt
ssl_options.certfile = /etc/server_ssl/server.crt
ssl_options.keyfile = /etc/server_ssl/server.keymanagement.ssl.port = 15671
management.ssl.cacertfile = /etc/server_ssl/ca.crt
management.ssl.certfile = /etc/server_ssl/server.crt
management.ssl.keyfile = /etc/server_ssl/server.key -
重新启动容器