It is possible to run Zigbee2MQTT in a Docker container using the official Zigbee2MQTT Docker image.
Next Post Emby Media Server on OMV 5 inside Docker with Portainer using RPi 4 Harish Kumar As a founder of the PcMac YouTube channel and website, Our goal is to provide Free Technical help to people and spread knowledge to everyone. This can be done via docker pull. Tagged docker, domotica, RPi Post navigation. Installing docker and docker-compose on a Raspberry Pi 4.
This image support the following architectures: 386
, amd64
, arm/v6
, arm/v7
, arm64
.Since Zigbee2MQTT images are manifest listed, Docker will auto-detect the architecture and pull the right image.
- Docker containers are a great way of quickly deploying software onto your device. To make your life easier when managing your Docker Containers, you can also set up Portainer on your Pi. Portainer is a neat piece of software that allows you to create and manage the containers within a web interface.
- Founded in 2004, Neodynamic designs and develops Barcode, Imaging, Labeling & Printing Tools for.NET, PHP, Docker & Web developers. We are experts in those fields with strong know-how on.NET, ASP.NET, SSRS, PHP & HTML/JS projects.
Note for Raspberry Pi 1 and zero users: there is a bug in Docker which selects the wrong image architecture.Before executing docker run
pull the correct image with docker pull koenkk/zigbee2mqtt --platform linux/arm/v6
.
First run the container, this will create the configuration directory. Change configuration.yaml
according to your situation and start again.
Running #
Run by executing the following commmand:
Parameters explanation #
Docker Pi 4 Relay Software
-v $(pwd)/data:/app/data
: Directory where Zigbee2MQTT stores it configuration--device=/dev/ttyACM0
: Location of adapter (e.g. CC2531)-v /run/udev:/run/udev:ro --privileged=true
: is optional, only required for autodetecting the port- Optional: in case your MQTT broker is running on
localhost
and is not within the same Docker network as the Zigbee2MQTT container also add--network host
.
Updating #
To update to the latest Docker image:
Tags #
The following tags are available:
- Latest release version:
latest
- Latest dev version (based on
dev
branch):latest-dev
- Specific release version, e.g:
1.7.0
Support new devices #
See How to support new devices
docker-compose example #
Docker Stack device mapping #
This is only relevant when using Docker Stack
Docker Raspberry Pi 4
Docker stack doesn’t support device mappings with option --devices
when deploying a stack in Swam mode. A workaround is to bind the device as volume binding and set the right permissions.
Install Docker On Rpi 4
The workaround is based on the solution found at Add support for devices with “service create”, all credits goes this him.
Docker Raspberry Pi 4 64 Bit
Identify cc2531 device Identify the cc2531 device using the following command:
UDEV Rules
Create a new udev rule for cc2531,
idVendor
andidProduct
must be equal to values fromlsusb
command. The rule below creates device/dev/cc2531
:Reload newly created rule using the following command:
Create docker-setup-cc2531.sh
Copy the following content: Download imovie compatible with el capitan.
Set permissions:
Create docker-event-listener.sh
Copy the following content:
Set permissions:
Create docker-event-listener.service
Copy the following content:
Set permissions:
Reload daemon
Start Docker event listener
Status Docker event listener
Enable Docker event listener
Verify and deploy Zigbee2MQTT stack
Now reconnect the cc2531. Verify using the following command:
Below an example of a
docker-stack-zigbee2mqtt.yml
:In the above example,
proxy_traefik-net
is the network to connect to the mqtt broker. The constraint makes sure Docker deploys only to this (rpi-3
) node, where the cc2531 is connected to. The volume binding/mnt/docker-cluster/zigbee2mqtt/data
is the zigbee2mqtt persistent directory, whereconfiguration.yaml
is saved.The zigbee2Zigbee2MQTTmqtt
configuration.yaml
should point to/dev/cc2531
:Deploy the stack: