Docker Community Forums

Share and learn in the Docker community.

Docker-compose mosquitto and zigbee2mqtt

I am in a learning phase and trying to understand docker, containers and all other related stuff. I have a question regarding the functioning of mosquitto and zigbee2mqtt.

I have deployed both containers using a docker-compose file, of which the content is:

mosquitto:

version: '3.8'
services:
  mqtt:
    image: eclipse-mosquitto:2.0
    restart: unless-stopped
    volumes:
      - "./mosquitto-data:/mosquitto"
    ports:
      - "1883:1883"
      - "9001:9001"
    command: "mosquitto -c /mosquitto-no-auth.conf"
![image|690x300](upload://bkfaG6WCc5pNqYkzUJGpZDrTRuE.png)

zigbee2mqtt:

  version: '3'
  services:
    zigbee2mqtt:
      container_name: zigbee2mqtt
      image: koenkk/zigbee2mqtt
      volumes:
        - ./data:/app/data
      devices:
        # CC251
        #- /dev/ttyUSB_cc2531:/dev/ttyACM0
        # CC2530 / GBAN GB2530S
        #- /dev/ttyUSB_cc2530:/dev/ttyACM0
      restart: always
![image|690x354](upload://qCYaMDO73A2ZLnxDJrwryv7LBUK.png)

configuration.yaml (zigbee2mqtt)

# Home Assistant integration (MQTT discovery)
homeassistant: false

# allow new devices to join
permit_join: true

# MQTT settings
mqtt:
  # MQTT base topic for zigbee2mqtt MQTT messages
  base_topic: zigbee2mqtt
  # MQTT server URL
  server: 'mqtt://localhost'
  # MQTT server authentication, uncomment if required:
  # user: my_user
  # password: my_password

# Serial settings
serial:
  # Location of CC2531 USB sniffer
  port: /dev/ttyACM0

These composer files are published on the web.
The deployment went fine and both containers are running. althoug I have some questions:

  1. The containers are running in a stack, which is using a different network subnet. I cannot reach the site going to the ip address of the host and one of the port numbers (1883/9001) why can’t I access it?

  2. The zigbee2mqtt container doesn’t have a port number published, is this ok, or should I add it ? I tried before, but even then I cannot access the site.

  3. Should I adjust the volumes so they share a common path to exchange information ?