It seems to be quite simple to add persistence to mosquitto. Simply add
persistence truepersistence_location /mosquitto/data
to data/mqtt/config/mosquitto.conf.
But - that doesn't work.
The reason is, that /mosquitto/data isn't mounted to data/mqtt/data, as one could expect.
You have to add
mqtt:
volumes:
- ./data/mqtt/data:/mosquitto/data
explicitly to the docker-compose.yml. Only then the persistence is really persistent.
It seems to be quite simple to add persistence to mosquitto. Simply add
persistence true
persistence_location /mosquitto/data
to data/mqtt/config/mosquitto.conf.But - that doesn't work. The reason is, that /mosquitto/data isn't mounted to data/mqtt/data, as one could expect. You have to add
explicitly to the docker-compose.yml. Only then the persistence is really persistent.