Docker创建mqtt容器mosquitto

#1.创建映射到主机的配置文件/bwss/agent/docker/mosquitto_public/config/mosquitto.conf
内容为:
listener 51883 0.0.0.0 # 0.0.0.0
allow_anonymous false

persistence false 
persistence_location /mosquitto/data
password_file /mosquitto/config/passwd

#2.拉取镜像
docker pull eclipse-mosquitto

#3.创建容器
docker run -d --name=mosquitto_test --privileged -p 51883:51883  -v /bwss/agent/docker/mosquitto_public/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /bwss/agent/docker/mosquitto_public/config/passwd:/mosquitto/config/passwd -v /bwss/agent/docker/mosquitto_public/data:/mosquitto/data -v /bwss/agent/docker/mosquitto_public/log:/mosquitto/log eclipse-mosquitto:latest


#4.进入容器,创建密码文件
docker exec -it mosquitto_test sh -c "mosquitto_passwd -c /mosquitto/config/passwd admin"
输入密码


#5.重启容器工具验证

你可能感兴趣的:(eureka,java,spring,cloud)