Setup MQTT on Synology DOCKER

Create folders:

mkdir -p /volume1/docker/mqtt/log
mkdir -p /volume1/docker/mqtt/data
mkdir -p /volume1/docker/mqtt/config
chmod 0777 /volume1/docker/mqtt/log

Cerate conf file: (/volume1/docker/mqtt/config/mosquitto.conf)

pid_file /var/run/mosquitto.pid
persistence true
persistence_location /mqtt/data/
password_file /mqtt/config/passwd_file
allow_anonymous false
user mosquitto
# Port to use for the default listener.
port 1883
log_dest file /mqtt/log/mosquitto.log
log_dest stdout

Setup Passws_file:

cd /volume1/docker/mqtt/data
mosquitto_passwd -c passwd_file %username%
password: %password%

Start Docker

sudo docker run –name mqtt –restart=always –net=host -tid -v /volume1/docker/mqtt/config:/mqtt/config:ro -v /volume1/docker/mqtt/log:/mqtt/log -v /volume1/docker/mqtt/data/:/mqtt/data/ toke/mosquitto

Leave a Reply