If you put all the containers in the same bridge network, then you can access them by name rather than by ip address. So with this docker-compose HA references MQTT using “mqtt” as the host name and “zwave” as the zwave host name. Also I’d recommend specifying specific versions of container images, such that an upgrade is a decision you make by changing the version vs just happens when you rebuild your docker. You can put all these constants in a .env file, so that’s the one place you go to change versions, subnets, etc.
version: '3'
networks:
local_network:
ipam:
driver: default
config:
- subnet: ${SUBNET}.0/24
services:
ha:
container_name: ha
image: homeassistant/home-assistant:${HA_VERSION}
volumes:
- ${DOCKER_FOLDER}/${HA_FOLDER}/config:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
environment:
PROXY_IP: ${SUBNET}.1
TZ: America/New_York
networks:
local_network:
ipv4_address: ${SUBNET}.2
depends_on:
- zwave
- mariadb
ports:
- 8123:8123
- 1400:1400
- 1401:1401
zwave:
container_name: zwave
image: zwavejs/zwave-js-ui:${ZWAVE_VERSION}
volumes:
- ${DOCKER_FOLDER}/${ZWAVE_FOLDER}:/usr/src/app/store
- /etc/localtime:/etc/localtime:ro
devices:
- /dev/ttyACM0:/dev/ttyACM0
restart: unless-stopped
environment:
TZ: America/New_York
networks:
local_network:
ipv4_address: ${SUBNET}.3
ports:
- 3000:3000
- 8091:8091
mqtt:
container_name: mqtt
image: eclipse-mosquitto:${MQTT_VERSION}
# chown 1883:1883
volumes:
- ${DOCKER_FOLDER}/${MQTT_FOLDER}/config:/mosquitto/config
- ${DOCKER_FOLDER}/${MQTT_FOLDER}/log:/mosquitto/log
- ${DOCKER_FOLDER}/${MQTT_FOLDER}/data:/mosquitto/data
restart: unless-stopped
user: "1883:1883"
environment:
TZ: America/New_York
networks:
local_network:
ipv4_address: ${SUBNET}.6
ports:
- 1883:1883
- 9001:9001
mariadb:
container_name: mariadb_ha
image: mariadb:10.11.2
volumes:
- ${DOCKER_LOCAL_FOLDER}/${MARIADB_FOLDER}:/var/lib/mysql
- ${DOCKER_LOCAL_FOLDER}/mariadb_conf:/etc/mysql/conf.d
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${MARIADB_PWD}
MARIADB_MYSQL_LOCALHOST_USER: "yes"
MARIADB_MYSQL_LOCALHOST_GRANTS: "yes"
MARIADB_AUTO_UPGRADE: "yes"
MARIADB_DISABLE_UPGRADE_BACKUP: "yes"
TZ: America/New_York
PUID: 1037
PGID: 100
networks:
local_network:
ipv4_address: ${SUBNET}.4
ports:
- 3316:3306
phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin:5.2.1
restart: unless-stopped
environment:
- PMA_HOST=mariadb_ha
hostname: phpmyadmin
domainname: phpmyadmin.st.home.arpa
networks:
local_network:
ipv4_address: ${SUBNET}.5
ports:
- 8088:80