Mosquitto Broker on Docker

1. add the firewall rule

firewall-cmd --add-port=8883/tcp
firewall-cmd --add-port=8883/tcp --permanent
firewall-cmd --add-port=9001/tcp
firewall-cmd --add-port=9001/tcp --permanent

2. download image

docker pull eclipse-mosquitto

3. create a container with the configuration mapping

docker run --name mosquitto \
    --restart=always \
    -i -t -p 8883:8883 -p 9001:9001 \
    -v /storage/mosquitto/config:/mosquitto/config:Z -v /storage/mosquitto/data:/mosquitto/data:Z \
    -v /storage/mosquitto/log:/mosquitto/log:Z \
    -d eclipse-mosquitto

Leave a Reply

Your email address will not be published. Required fields are marked *