Description
Hello!
I have been desperately trying to get knxd running in a Docker container. I found the cause and was able to fix it, but maybe there is another or better solution?
But from the beginning:
I am using the docker image from michelde, which you can find here:
https://github.com/michelde/knxd-docker/
As KNX gateway I have the IP Interface SCN-IP000.02 from MDT that was previously running on my PI with the following configuration:
KNXD_OPTS="-e 1.1.251 -E 1.1.251:8 -b ipt:192.168.10.250"
START_KNXD=YES
This is what my docker-compose.yaml looks like now
services:
knxd:
image: michelmu/knxd-docker:latest
container_name: knxd
restart: always
ports:
- "6720:6720/tcp"
- "3671:3671/udp"
cap_add:
- SYS_MODULE
- SYS_RAWIO
environment:
- ADDRESS=1.1.251
- CLIENT_ADDRESS=1.1.251:8
- DEBUG_ERROR_LEVEL=debug
- INTERFACE=ipt
- IP_ADDRESS=192.168.10.250
- DEST_PORT=3671
which leads to the following ini copied from the container:
[main]
addr = 1.1.251
client-addrs = 1.1.251:8
connections = server,A.tcp,interface-ipt
logfile = /dev/stdout
debug = debug
[A.tcp]
server = knxd_tcp
[server]
server = ets_router
tunnel = tunnel
router = router
discover = true
name = knxd
[debug]
error-level = debug
[interface-tpuart]
driver = tpuart
device =
filters =
[interface-tpuart-ip]
driver = tpuart
ip-address = 192.168.10.250
dest-port = 3671
filters =
[interface-usb]
driver = usb
device =
bus =
filters =
send-timeout = 3000
[interface-ipt]
driver = ipt
ip-address = 192.168.10.250
dest-port = 3671
[interface-ft12]
driver = ft12
device =
filters =
send-timeout = 3000
[interface-ft12cemi]
driver = ft12cemi
device =
filters =
send-timeout = 3000
[interface-ncn5120]
driver = ncn5120
device =
filters =
[interface-ncn5120-ip]
driver = ncn5120
ip-address = 192.168.10.250
dest-port = 3671
filters =
[interface-dummy]
driver = dummy
However, when starting the container, I'll get this error:
knxd | I00000131: [ 1:main] 0.14.66: knxd /etc/knxd.ini
knxd | I00000129: [ 1:main] Connected: cfg:interface-ipt.
knxd | I00000129: [ 1:main] Connected: cfg:A.tcp.
knxd | I00000129: [ 1:main] Connected: cfg:server.
knxd | W00000126: [ 1:main] knxd should not run as root
knxd | N00000127: [21:router.pace_] The 'pace' filter without a queue acts globally.
knxd | F00000105: [15:interface-ipt] Link down, terminating
knxd | N00000128: [ 1:main] Shutting down.
I trace the communication with Wireshark and figured out, that knxd is using the IP-Adress of the Docker Container:
I changed the Docker network_mode to host.
services:
knxd:
image: michelmu/knxd-docker:latest
container_name: knxd
restart: always
cap_add:
- SYS_MODULE
- SYS_RAWIO
environment:
- ADDRESS=1.1.251
- CLIENT_ADDRESS=1.1.251:8
- DEBUG_ERROR_LEVEL=debug
- INTERFACE=ipt
- IP_ADDRESS=192.168.10.250
- DEST_PORT=3671
network_mode: host
Now it looks better:
However, is there a way to run knxd in a Docker container without host mode?
Many thanks in advance!
Best regards,
NehCoy