This is a simple Mosquitto broker to quickly initialize projects requiring an MQTT broker.
- Docker
- Docker compose +v1.27.0 (better to have v2)
To start the container, just :
UID=$UID GID=$GID docker-compose up -dThe Mosquitto broker is now available on localhost. You can test it easily (require Mosquitto client):
| In one shell:
mosquitto_sub -h localhost -t "sensor/temperature"| In a second shell:
mosquitto_pub -h localhost -t sensor/temperature -m 23The config file is in the file mosquito.conf
By default we activated the log and data persistance (logs are in the log folder, and data are stored in a docker voume).
In the config file, just uncomment the Authentication part and then restart the container.
The default user is admin/password.
You always have to restart if you want the modification to be taken in account:
docker-compose restartdocker-compose exec mosquitto mosquitto_passwd -b /mosquitto/config/password.txt user passworddocker-compose exec mosquitto mosquitto_passwd -D /mosquitto/config/password.txt user