A tiny MQTT-Broker docker image

Intro

Some time ago I started to get a look at MQTT and needed a broker to start with. Eclipse Mosquitto (http://mosquitto.org/) was a logical choice for a quick start and as I am a fan of docker containers for not polluting your local system installation whilst trying new software stacks, I searched for a docker image with Mosquitto.

 

Of course, there were many, but I was a bit astonished about their size. 500MB and more? That’s not what I expected from an efficient docker build result. I started to check what the exact technical requirements of Mosquitto were and actually, it doesn’t need so much to run.

Approach

The most simple way would be a small Linux coming at least with a package manager to get it up and running, as it is pointed out here: https://mosquitto.org/download/The OpenWRT approach seemed to be the most interesting, as it is available for various CPU types and its known to be damn small.

Solution

A short time later the Dockerfile was written and an image which was packed below 4MB. I’d call that a success J You can find the results right here https://hub.docker.com/r/mrinus/docker-openwrt-mosquitto/ or by doing a docker pull on mrinus/docker-openwrt-mosquitto and run the image by:

docker run -p 1883:1883 -d mrinus/docker-openwrt-mosquito


Dockerfile

BTW

Just to mention it: Nowadays there is an official image locatable as eclipse/mosquito which has an even smaller footprint. As they did not provide a build tagged latest you can run it by giving the latest build tag:

 

docker run eclipse/mosquitto:1.4.8 –p 1883:1883
 
Have fun exploring MQTT!
Dieser Beitrag wurde unter BPM & System Integration, IoT & Industry 4.0 abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s