--- services: mosquitto: image: eclipse-mosquitto:latest ports: - 1883:1883 - 8883:8883 - 9001:9001 # some images use this port, check and change the host port accordingly volumes: - CHANGE_TO_COMPOSE_DATA_PATH/mosquitto/config:/mosquitto/config # you've to create a conf file, see below for sample - CHANGE_TO_COMPOSE_DATA_PATH/mosquitto/data:/mosquitto/data - CHANGE_TO_COMPOSE_DATA_PATH/mosquitto/log:/mosquitto/log networks: - mosquitto networks: mosquitto: name: mosquitto driver: bridge ##### # Sample mosquitto.conf ##### # persistence true # persistence_location /mosquitto/data/ # log_dest file /mosquitto/log/mosquitto.log # allow_anonymous true # listener 1883 #####