Hi, i haver trying to install by docker in synology nas. For now i have installed ok HA and configurator, but i have a problem with mosquitto. i install the docker and everything is correct if i configure mqtt in HA by localhost but if i write ip in HA or in MQTT Explorer it doesn´t work.
this is my mosquitto. conf
persistent true
persistence_location /mosquitto/data
log_dest file /mosquitto/log/mosquitto.log
listener 1883
allow_anonymous true
pkscout
(Kyle Johnson)
October 15, 2023, 11:07am
2
There might be an issue with your Docker compose file (or however you setup the Docker image to run). Here’s my Docker compose file for mosquitto, and everything works fine:
version: '3'
services:
mqtt-server:
container_name: mqtt-server
volumes:
- '/volume1/configs/mosquitto/config:/mosquitto/config'
- '/volume1/configs/mosquitto/data:/mosquitto/data'
- '/volume1/configs/mosquitto/log:/mosquitto/log'
environment:
- SET_CONTAINER_TIMEZONE=true
- CONTAINER_TIMEZONE=America/New_York
ports:
- '1883:1883'
- '9001:9001'
image: 'eclipse-mosquitto:latest'
restart: unless-stopped
security_opt:
- apparmor=unconfined
and my mosquitto config file:
listener 1883 0.0.0.0
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
log_dest stdout
log_dest file /mosquitto/log/mosquitto.log
(please, nobody get on me about anonymous access, I made the choice I made based on my network config)
thanks for the information but i have tryed with you same configuration and i obtain same error. i dont know if it is error with permission or what
tmjpugh
(Tmjpugh)
October 15, 2023, 4:19pm
5
Is localhost correct. Hostname is best and persistent in docker containers in my opinion.
services:
mqtt-server:
container_name: mqtt-server
hostname: mqtt
volumes:
then use mqtt:1833 for connection instead of ip if connecting within docker network
i have try a lot of things.i think the problem was with anonymous access. thanks for your help!