A Fresh Approach to Local MQTT Development

Need a local MQTT instance on your machine? Want to integrate Node-Red too? Docker makes this incredibly simple. I'll show you exactly how to get everything up and running with minimal effort. Before we begin, verify that Docker is properly installed on your system. You can download Docker Desktop from the official website where you'll also find comprehensive installation instructions. I also suggest installing just, a useful tool that simplifies running commands from your terminal with minimal typing. Create a new directory and add the following compose.yml file : services: mosquitto: image: eclipse-mosquitto ports: - "1883:1883/tcp" - "8090:8090" volumes: - ./mosquitto/config.txt:/mosquitto/config/config.txt environment: - TZ=Europe/Zurich node-red: image: nodered/node-red ports: - "1880:1880" volumes: - ./node-red/data:/data environment: - TZ=Europe/Zurich links: - "mosquitto:mqtt-broker" - "mosquitto:mqtt" - "mosquitto:broker" Adapt the timezone to your location. Create a directory mosquitto and add the following mosquitto.conf file : # Config file for mosquitto listener 1883 protocol mqtt listener 8090 protocol websockets allow_anonymous true Create another directory node-red and add the following Dockerfile : FROM nodered/node-red RUN npm install @flowfuse/node-red-dashboard RUN npm install @flowfuse/node-red-dashboard-2-ui-led

Apr 30, 2025 - 15:55
 0
A Fresh Approach to Local MQTT Development

Need a local MQTT instance on your machine? Want to integrate Node-Red too? Docker makes this incredibly simple. I'll show you exactly how to get everything up and running with minimal effort.

Before we begin, verify that Docker is properly installed on your system. You can download Docker Desktop from the official website where you'll also find comprehensive installation instructions.

I also suggest installing just, a useful tool that simplifies running commands from your terminal with minimal typing.

Create a new directory and add the following compose.yml file :

services:
  mosquitto:
    image: eclipse-mosquitto
    ports:
      - "1883:1883/tcp"
      - "8090:8090"
    volumes:
      - ./mosquitto/config.txt:/mosquitto/config/config.txt
    environment:
      - TZ=Europe/Zurich

  node-red:
    image: nodered/node-red
    ports:
      - "1880:1880"
    volumes:
      - ./node-red/data:/data
    environment:
      - TZ=Europe/Zurich
    links:
      - "mosquitto:mqtt-broker"
      - "mosquitto:mqtt"
      - "mosquitto:broker"

Adapt the timezone to your location.

Create a directory mosquitto and add the following mosquitto.conf file :

# Config file for mosquitto
listener 1883
protocol mqtt
listener 8090
protocol websockets
allow_anonymous true

Create another directory node-red and add the following Dockerfile :

FROM nodered/node-red

RUN npm install @flowfuse/node-red-dashboard
RUN npm install @flowfuse/node-red-dashboard-2-ui-led