Multiple openhab2 container on same docker host

Dear All!

Could you help me how should i configure docker network for openhab2, to run multiple instances openhab2 on same host.

The host type isnt good as i read, rather the bridge, but im beginner in docker usage…
I have tried to use in bridge mode, the container started but which host port should i reach the internal 8080 on? Or do i have to configure it in the service startexec part?
(One Test, and one container for Prod)

Thank you in advance!

OH is not designed to have more than one instance running on a host at the same time.

Most of the people I know who have talked about having a prod and test instance use separate VMs or separate RPis for the two or they use periods of processing (i.e. only run one instance at a time).

You can probably make this work on the same host with Docker but you will need to completely separate the networks for the two. In short, your prod instance will use --net=host as recommended but your test instance will expose ports 8080 and 8443 mapped to some other port so as not to interfere with your prod instance. Also note that your two instances will need to have separate mounted volumes and any USB dongles or devices will only be accessible to one instance at a time. You will probably want to use separate databases or at least separate tablespaces for your persistence and you might need to use separate MQTT topics and the line as well.