November-27th-2017, 06:53 AM
We have uploaded a new Docker image that turns your netPI into an MQTT broker:
https://hub.docker.com/r/hilschernetpi/n...tt-broker/
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
December-16th-2019, 07:22 AM
Hello Carlos,
you are right the Docker image is no more.
The reason why I decided to remove the Hilscher docker image for Mosquitto is quite simple. The organizsation Mosquitto itself offer a very official Docker image a long time ago under
https://hub.docker.com/_/eclipse-mosquitto. So hence it does not make sense for Hilscher to offer it.
So the image to load is "eclipse-mosquitto". As you can read it on the page you need to add the ports 1883:1883 and 9001 :9001 to make it available to the "outside world".
If there is something you want to change in the mosquitto.conf file then you can open a console "/bin/ash"
in netPI's Docker web GUI and make your edits then usig the editor vi for example
Thx
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
March-3rd-2021, 11:17 AM
(This post was last modified: March-3rd-2021, 11:38 AM by Armin@netPI.)
Well for a better view I recommend to all MQTT users to install the tool MQTT-Explorer
http://mqtt-explorer.com/ under windows (instead of Node-RED).
This tool is for free and much better to explore a running MQTT broker since it monitors ALL topics at once.
As next I installed the same eclipse-mosquitto:latest as you did. I also mapped the ports 1883 and 9001 ... and guess what ... the MQTT broker is not reachable via MQTT Explorer. So there seems to be a general problem with the latest version
When you click on the container and watch the log file it says:
Code:
1614766138: mosquitto version 2.0.7 starting
1614766138: Config loaded from /mosquitto/config/mosquitto.conf.
1614766138: Starting in local only mode. Connections will only be possible from clients running on this machine.
1614766138: Create a configuration file which defines a listener to allow remote access.
1614766138: Opening ipv4 listen socket on port 1883.
1614766138: Opening ipv6 listen socket on port 1883.
1614766138: Error: Address not available
1614766138: mosquitto version 2.0.7 running
"Starting in
local only mode .
Connections will only be possible from clients running on this machine" ? I don't know what this means right now. Maybe this is the explanation why it does not reachable from remote machines.
I think on the MQTT broker landing page
https://hub.docker.com/_/eclipse-mosquit...escription you will find more about this "local" mode. At the moment I am clueless. Earlier version worked well and with no problems at all.
Thx
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
Well I read more details about the very latest version of Mosquitto with a breaking major change due to security reasons here:
https://mosquitto.org/documentation/migrating-to-2-0/
This change will have influence on the very latest version of Mosquitto Docker image version 2.x as well and explains, why the images does not work right away. I suppose after deploying the docker container, you need to edit the configuration file in the container manually.
Of course it is always possible to load instead of the "eclipse-mosquitto:latest" = 2.x version the old version 1.x with "eclipse-mosquitto:1.6.13" instead
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
March-3rd-2021, 11:36 AM
(This post was last modified: March-3rd-2021, 11:39 AM by Armin@netPI.)
I got it working now also with version 2.x.
Based on the documentation at
https://mosquitto.org/documentation/migrating-to-2-0/ I added two lines additionally in the mosquitto configuration file in the container named
Code:
/mosquitto/config/mosquitto.conf
The two lines are
Code:
listener 1883
allow_anonymous true
Then I restarted the container and everything went well.
P.S.: I saw in your container screen shot you enabled the "privileged" flag. This is not necessary at all to set for the mosquitto container.
Thx
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
March-3rd-2021, 11:50 AM
(This post was last modified: July-20th-2021, 11:45 AM by Armin@netPI.)
Here is how to edit the configuration file in the container manually using the embedded container console in 7 steps:
1. Click the embedded console icon of the container
2. Choose "/bin/sh" as console terminal service and press connect
3. Call "vi" Linux editor plus the file to edit with "vi /mosquitto/config/mosquitto.conf"
4. Press key "i" in the opening editor to activate the editor mode to "inserting"
5. Insert the lines as first lines in the file
"listener 1883"
"allow_anonymous true"
6. Press key "Esc" and then ":" then "w" and then "q" which is the command "write quit".
7. Then restart the container
Here is a picture of the steps 1 to 5
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
Dear Armin,
Thank you very much for your quick and kind response.
I tried 2 things according to your information.
1) I loaded eclipse-mosquitto:1.6.
2) I loaded eclipse-mosquitto:latest and modified the file 'mosquitto.conf' to add 2 lines.
Both of the above, the MQTT communication worked successfully.
I confirmed that from both of the debug view by debug node and MQTT Explorer.
I really appreciate your support!!!
Best regards,