Docker physical LAN port

Platform: currently RPI4, then Rackstation 822+

now as stated, I am planning on moving my OpenHab installation from a RPi4 to a Docker on the mentioned Rackstation. However, I am still a little unsure about the networking of the installation. Is there a way of just giving one of the LAN ports to the Openhab Docker? This sounds like the easiest solution to me, but I found a lot about virtual LAN and second IP addresses, but nothing about just giving one physical LAN port to a docker (the RS822+ has 4 ports, so I have a couple on hand…)

Thanks for any advice!

This came up on google: How to Pass-through Physical NIC to Docker Container? - Stack Overflow

However, it’s easier to just set the docker container to host networking mode.

What do you mean by LAN port? If you have 4 physical RJ45 connectors to you Rackstations, that basically means that you have 4 different network cards.
They can be connected to switch and get IP-nummer in the same subnet, or they could be in totally isolated networks.

The way docker works (default) is that it runs on host. It has its own internal network and ip. The host then maps local ports that goes to docker.

You can give the docker container a dedicated ip number in the same subnet as the host. Then the host where you run docker will still have its own ip which not the same as the docker container.

So lets assume this example

Docker runs.on
Openhab docker container

Look at mcvlan driver for docker to achieve this. Macvlan network driver | Docker Docs

The other option is to use port forward, I.e.Docker on same ip as host but running on a.specific port. This is what’s used default on docker.

Third option, yes you can run docker on separate network, you then have to make sure your clients have access to that network and you have to route in between networks.
So do this simply create a new docker network with the desired network ip, host etc

Regards, S

Okay, so I am a little confused
I read a little bit about macvlan, and as far as I understand it allows me to assign additional IP-Adresses to my host and assigning one of these IP-addresses to my docker container. However it is also possible to just use one of the eth ports to pass it through completely?
This sounds quite interesting to me, as this would let me completely separate traffic and make the traffic transparent to my unifi solution.