argh that’s not cool 
To avoid all these issues, I use Docker Compose and Portainer.
Docker Compose lets me install whatever I want and freeze the versions, and Portainer lets me manage all of that with a nice graphical interface (with access to logs, CPU/RAM/disk stats, etc.).
You create the volume for Portainer once:
docker volume create portainer_data
And the docker run command you run is:
docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
then you can connect at http://your-machine-ip:9000
I created a Stack named gladys-assistant where I put the Docker Compose:
version: "3"
services:
gladys:
image: gladysassistant/gladys:v4
container_name: gladys
restart: always
privileged: true
network_mode: host
cgroup: host
logging:
driver: "json-file"
options:
max-size: 10m
environment:
NODE_ENV: production
SQLITE_FILE_PATH: /var/lib/gladysassistant/gladys-production.db
SERVER_PORT: 80
TZ: Europe/Paris
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/gladysassistant:/var/lib/gladysassistant
- /dev:/dev
- /run/udev:/run/udev:ro
watchtower:
image: containrrr/watchtower
restart: always
container_name: watchtower
command: --cleanup --include-restarting
volumes:
- /var/run/docker.sock:/var/run/docker.sock
and to that you can add your Matterbridge, your dedicated z2m, your MQTT broker, your zwavejs-ui, Node-RED, etc. if, of course, you want to manage it instead of Gladys.
matterbridge:
container_name: matterbridge
image: luligu/matterbridge:latest # Matterbridge image with the latest tag
network_mode: host # Ensures the Matter mdns works
restart: always # Ensures the container always restarts automatically
volumes:
- "${HOME}/Matterbridge:/root/Matterbridge" # Mounts the Matterbridge plugin directory
- "${HOME}/.matterbridge:/root/.matterbridge" # Mounts the Matterbridge storage directory
zigbee2mqtt:
image: koenkk/zigbee2mqtt:2.2.1
# image: koenkk/zigbee2mqtt:1.42.0
container_name: zigbee2mqtt
restart: unless-stopped
environment:
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- NODE_ENV=production
- TZ=Europe/Berlin
volumes:
- ./data:/app/data:rw
- /run/udev:/run/udev:ro
ports:
- 12000:12000
network_mode: host
devices:
# Make sure this matched your adapter location
- /dev/serial/by-id/usb-Txxxxxxxyyyyyyyy:/dev/ttyACM0
# run a rootless container with Docker Compose by adding the following attributes
# group_add:
# - dialout
# user: 1000:1000
These are examples that must be adjusted to your configuration, notably when creating these directories.
Anyway, that’s what I do and it works pretty well for me; I can « play » with different versions, always backing up first!
With this method I can also create a test Gladys, for example:
version: '3'
services:
gladys:
# image: cicoub13/gladys:tuya-rain
image: gladysassistant/gladys:matter-integration
# image: sescandell/gladys-test:zjs-battery
# image: sescandell/gladys-test:pr-zwaveJsMeter
# image: gladysassistant/gladys:zigbee2mqtt-tuya-me201wz
# image: gladysassistant/gladys:dashboad-add-other-aggregate-functions
container_name: gladys-test
restart: always
privileged: true
network_mode: host
logging:
driver: "json-file"
options:
max-size: 10m
environment:
NODE_ENV: production
SQLITE_FILE_PATH: /var/lib/gladysassistant/gladys-production.db
SERVER_PORT: 8001
TZ: Europe/Paris
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./gladysassistant-test:/var/lib/gladysassistant
- /dev:/dev
- /run/udev:/run/udev:ro
mosquitto:
image: eclipse-mosquitto:2.0.20
container_name: gladys-test-mqtt
restart: unless-stopped
# command: mosquitto -c /mosquitto-no-auth.conf
environment:
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- VERSION=2.0.20
- DOWNLOAD_SHA256=azszderzbenrac6
- GPG_KEYS=azszderzbenr
- LWS_VERSION=4.2.1
- LWS_SHA256=azszderzbenr
volumes:
- ./mqtt-test/config:/mosquitto/config:rw
- ./mqtt-test/data:/mosquitto/data:rw
- ./mqtt-test/log:/mosquitto/log:rw
ports:
- 1888:1888
network_mode: host
matterbridge:
image: luligu/matterbridge:latest
container_name: gladys-test-matterbridge
restart: always
network_mode: host
volumes:
- ./matterbridge-test/Matterbridge:/root/Matterbridge
- ./matterbridge-test/.matterbridge:/root/.matterbridge
In your case, I think it would be good to manage z2m that way.
However, you’ll need to disable z2m management by Gladys, then set up Portainer, start a Stack (with z2m version 2.3.0 for example) and run it. Then go back into Gladys and add your external z2m docker:
Hope you get everything back.