Docker

It is possible to run Zigbee2mqtt in a Docker container using the official Zigbee2mqtt Docker image.

First run the container, this will create the configuration directory. Change configuration.yaml according to your situation and start again.

Parameters

Supported architectures

amd64

docker run \
   -it \
   -v $(pwd)/data:/app/data \
   --device=/dev/ttyACM0 \
   -e TZ=Europe/Amsterdam \
   koenkk/zigbee2mqtt

arm32v6 (E.G. Raspberry Pi)

docker run \
   -it \
   -v $(pwd)/data:/app/data \
   --device=/dev/ttyACM0 \
   -e TZ=Europe/Amsterdam \
   koenkk/zigbee2mqtt:arm32v6

arm64v8

docker run \
   -it \
   -v $(pwd)/data:/app/data \
   --device=/dev/ttyACM0 \
   -e TZ=Europe/Amsterdam \
   koenkk/zigbee2mqtt:arm64v8

Updating

To update to the latest Docker image:

docker rm -f [ZIGBEE2MQTT_CONTAINER_NAME]
docker rmi -f [ZIGBEE2MQTT_IMAGE_NAME] # e.g. koenkk/zigbee2mqtt:arm32v6
# Now run the container again, Docker will automatically pull the latest image.

Tags

The following tags are available:

Support new devices

To add support for new devices, you’ll need to git clone zigbee-shepherd-converters to $(pwd)/data/zigbee-shepherd-converters first:

git clone https://github.com/Koenkk/zigbee-shepherd-converters.git $(pwd)/data/zigbee-shepherd-converters

If you’re integrating zigbee2mqtt with HomeAssistant, you’ll also need to copy homeassistant.js (https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/extension/homeassistant.js) to $(pwd)/data/lib/extension/homeassistant.js.

Then run the docker command like this:

docker run \
   -it \
   -v $(pwd)/data:/app/data \
   -v $(pwd)/data/zigbee-shepherd-converters:/app/node_modules/zigbee-shepherd-converters \
   -v $(pwd)/data/lib/extension/homeassistant.js:/app/lib/extension/homeassistant.js \
   --device=/dev/ttyACM0 \
   -e TZ=Europe/Amsterdam \
   koenkk/zigbee2mqtt

After that follow the guide to add support for new devices.

docker-compose Example

  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
      network_mode: host
      environment:
        - TZ=Europe/Amsterdam