docker搭建mqtt

docker search mqtt
docker pull 镜像
 
docker image
找出自己的镜像
 
docker run --name gqw-mqtt -p 1883:1883 -p 9001:9001 镜像名字
 
docker ps
可查看容器
 
--------------------------------------------------------------------------------------------
下面是配置容器的文件
--------------------------------------------------------------------------------------------
docker -exec -it ID sh
vi /mosquitto/config/mosquitto.conf
加上 allow_anonymous false # 关闭匿名模式
password_file /mosquitto/config/pwfile.conf # 指定密码文件
touch /mosquitto/config/pwfile.conf
vi /mosquitto/config/pwfile.conf
用户名 密码
 
 
原文地址:https://www.cnblogs.com/Guser/p/14875322.html