Connecting to BACnet devices from Docker container
How to configure Docker & SIA Connect ANY-Ware to access BACnet devices
Linux OS only
It is only possible to connect to BACnet devices through Docker from a Linux OS. Docker for Windows does not yet have support for UDP broadcasting which is required in order to communicate with BACnet devices
In order to allow Docker to do UDP broadcasting the network must be set from bridged mode to host mode
Docker composer project
Open you docker-compose.yml file and under the desired container add network_mode: “host”
The example below shows and example of the SIA Connect ANY-Ware composer project with the network mode set to host in line 7:
version: '3.8'
services:
siaconnect:
image: siaconnect/siaconnect:latest
container_name: siaconnect
network_mode: "host"
environment:
- SIA_CONNECT_PASSWORD=${SIA_CONNECT_PASSWORD:-SIACONNECT_ADMIN_PASSWORD}
- APP_CONTAINER_HUB_EMAIL=${APP_CONTAINER_HUB_EMAIL:-admin@sia-connect.com}
- APP_CONTAINER_HUB_PORT=${APP_CONTAINER_HUB_PORT:-8000}
volumes:
- siaconnect_data:/opt/SIA/plugins
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "443:443"
- "4840:4840"
- "80:80"
restart: always
volumes:
siaconnect_data:
networks:
bridge:
driver: bridge
Docker command
If using the Docker command to run SIA Connect ANY-Ware you need to start it with the parameter --network=host
Below shows an example of the Docker command:
docker run --name siaconnect --network=host -e "SIA_CONNECT_PASSWORD=secret_password" -v siaconnect_data:/opt/SIA/plugins --restart=always siaconnect/siaconnect:latest
Defining the proper network interface
After enabling the host mode the Docker container running SIA Connect ANY-Ware needs to be restarted
When the Docker container is started in host mode the container and utilize the native ports on the hosts network interfaces.
The network interface that is connected to the BACnet devices needs to defined in the Network Interface parameter in the BACnet instance. Do the following steps to locate right network interface and assign it to the BACnet device
-
On the host computer run
ifconfig
and find the correct interface. For example:siaconnect@siaconnect:~$ ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:e1ff:fe56:d17e prefixlen 64 scopeid 0x20<link> ether 02:42:e1:56:d1:7e txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 205 bytes 39666 (39.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enxcc96e59ddce1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.20.30.44 netmask 255.255.255.0 broadcast 10.20.30.255 inet6 fe80::b293:86cf:71c0:2ff6 prefixlen 64 scopeid 0x20<link> ether cc:96:e5:9d:dc:e1 txqueuelen 1000 (Ethernet) RX packets 1470022 bytes 2041019909 (2.0 GB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 723723 bytes 84097751 (84.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether cc:96:e5:9d:dc:e1 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 717408 bytes 296015023 (296.0 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 717408 bytes 296015023 (296.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In this example we have connected enxcc96e59ddce1 to our BACnet device.
- Open the BACnet instance (or add the instance) in SIA Connect.
- Set the Network Instance parameter to equal the desired network interface. In our case enxcc96e59ddce1