Setting up a Mosquitto MQTT server in docker.

    Docker compose

    version: "3"
    
    services:
      mosquitto:
        image: eclipse-mosquitto
        container_name: mosquitto
        ports:
          - 1883:1883
          - 9001:9001
        volumes:
          - ./config:/mosquitto/config
          - ./data:/mosquitto/data
          - ./log:/mosquitto/log
    

    Config

    also see this page for general configuration ideas

    persistence true
    persistence_location /mosquitto/data/
    log_dest file /mosquitto/log/mosquitto.log
    
    listener 1883
    allow_anonymous true
    #password_file /mosquitto/conf/mosquitto.conf
    

    External Resources