Was: [Mosquito container no longer available on LAN after recreate container]
On a freshly started Docker,
sudo docker-compose up -d results in a functioning MQTT broker that is accessible on the LAN on port 1883. However if I ‘down’ this container and then ‘up’ it again, it is no longer accessible on the LAN. Testing inside the container shows the service available on port 1883.
The only ways I have successfully gotten the broker accessible on the LAN again are:
- restart Docker (not really a realistic solution)
- change the host port in the
docker-compose.ymlfile before the next ‘up’ but this obviously is not a solution as all the clients expect to use 1883.
There must be something I’m missing. How do I recreate the container and be able to use the same port without having to restart Docker?
version: "3.8" services: mqtt: image: eclipse-mosquitto container_name: mqtt ports: - 1883:1883 - 8883:8883 volumes: - ./config:/mosquitto/config - ./data:/mosquitto/data - ./log:/mosquitto/log restart: always networks: - iot-net networks: iot-net: driver: bridge name: iot-net
If it matters here is the mosquitto.conf file
persistence true persistence_location /mosquitto/data/ log_dest file /mosquitto/log/mosquitto.log listener 1883 allow_anonymous false password_file /mosquitto/data/pass
Running Docker on Asustor NAS (Busybox) using latest docker and Mosquitto images.