Analytics cookies only (Google Analytics, PostHog). No ad networks, no cross-site tracking. See our privacy policy.
Self-host Eclipse Mosquitto
updated Oct 2026deployed by usprices checked · Jul 2026Install verified on Ubuntu 26.04 · Oct 2026 · how we test
We earn commissions when you shop through the links below. Full disclosure →
A lightweight MQTT message broker from the Eclipse Foundation: the publish/subscribe hub that smart-home devices, Zigbee bridges and sensors talk through. A small C program with TLS, authentication and persistence, published as an official Docker image.
Runs on a VPS from $5/mo (Linode Nanode 1 GB, 1 GB RAM) · prices checked Oct 2026
Our recommendation
Pick Eclipse Mosquitto when your sensors, bridges and home-automation apps speak MQTT and you want the lightest broker to put in the middle: it is a small C program from the Eclipse Foundation that handles publish/subscribe messaging, with authentication, TLS listeners and persistence you configure in `mosquitto.conf`. It is dual-licensed EPL-2.0 or EDL-1.0 (BSD-3-Clause). The official image is Alpine-based and its Docker Hub page recommends `latest` or a pinned `2.1*-alpine` tag; ours pins `2.1.2-alpine`. Our snippet writes a minimal config with a password file made by `mosquitto_passwd`, anonymous access off and persistence on, and checks that an authenticated publish is accepted. We did not find an upstream RAM minimum, so our 64 MB floor is an estimate. Mosquitto has no web interface: the catalog's Home Assistant, openHAB and ESPHome are among the things that connect to a broker like this.
What you need
Any VPS with at least 64 MB of RAM
A domain you control — most self-hosted setups need HTTPS in front of them
The Mosquitto image's Docker Hub page and configuration flag these before you connect devices:
non-negotiableThe image has three directories: /mosquitto/config, /mosquitto/data and /mosquitto/log. The page says the image runs with default configuration values unless you mount your own mosquitto.conf in the config directory, and that you must expose any non-default ports yourself. Our config sets listener 1883, allow_anonymous false and a password_file, and enables persistence under /mosquitto/data/.
non-negotiableThe broker runs as the mosquitto user (UID and GID 1883) and the image's entrypoint changes the ownership of /mosquitto/data to PUID/PGID (default 1883); our snippet sets that ownership on the two bind-mounted folders. The password is generated once and kept only in your shell variable; the passwd file holds its hash.
non-negotiablePort 1883 is unencrypted MQTT, so passwords and messages cross the network in the clear. Keep it on a trusted network, or configure a TLS listener with your own certificates before opening it to the internet; a private CA such as step-ca can issue them.
non-negotiableOld tutorials use the 1.x and 2.0 images: the page lists 2.0.22-openssl and 1.6.15-openssl lines alongside the 2.1 Alpine tags. Read the configuration reference for the line you run, and pin it.