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.
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.
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
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