Docker MQTT Newbie Question

Posted on
Wed Sep 06, 2023 9:28 pm
JustJack offline
Posts: 53
Joined: Feb 16, 2013
Location: Ca

Docker MQTT Newbie Question

So I have decided to dip my toes into the world of mqtt iot devices. I have some very basic questions that I was hoping someone could answer. I have decided that I wanted to go the Docker route because it seems like a sane way to keep from messing my machine up with brew installs. My question is with regards to persisting data across the docker container reboots. Most of the docs I have found say that I would want to save the following data :

    /mosquitto/config
    /mosquitto/data
    /mosquitto/log
My question is which of the two methods of creating persistent data are people using?

    Volumes
    Bind Mounts

According to the Docker documentation, volumes are the preferred approach, but you can't browse the data from the host's file system. I'm pretty sure that I would/should not be mucking withe the /mosquitto/data directory from outside the container while it is running but it makes it easier to backup if it's bind mounted to a Mac host directory. The other two would be nice to have access to. After a time though, I don't think that I would be modifying the config file much.

Any suggestions on what is the best route? I'm assuming that I could use both, creating a docker volume for the data, and binding the config and log files.

Posted on
Thu Sep 07, 2023 2:48 am
siclark offline
Posts: 1963
Joined: Jun 13, 2017
Location: UK

Re: Docker MQTT Newbie Question

I struggled getting Docker to reliably restart after reboots. I used the MQTT plugin for a while but found it had issues.

Since installing mosquitto with Brew (had been against Brew for same reasons you state) I havent had a single problem with it. Much the easiest and quickest route.

Posted on
Thu Sep 07, 2023 5:51 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Docker MQTT Newbie Question

Honestly, if you're just getting started with MQTT IoT, Mosquitto is overkill. Just run the MQTT Broker plugin. You don't need all the config and logging data, you'll never look at it. Just run an MQTT client app like MQTTX or MQTT Explorer, and monitor the traffic that way.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Sep 07, 2023 11:48 am
JustJack offline
Posts: 53
Joined: Feb 16, 2013
Location: Ca

Re: Docker MQTT Newbie Question

I’m still struggling with getting the Docker/mosquito configuration working, so I’ll give the plugin a try today.


Sent from my iPhone using Tapatalk

Posted on
Sun Sep 10, 2023 6:09 pm
JustJack offline
Posts: 53
Joined: Feb 16, 2013
Location: Ca

Re: Docker MQTT Newbie Question

Just wanted to thank you for the suggestion to just use your Broker plugin. It was so much easier to setup and get working :D :D :D :D

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests