I’m looking for a way to share a single container with 2 or more vlans. For example allow connections between a single Nextcloud container and 4 vlans being vlan 200, 210, 220 and 230. The subnets are 192.168..0/24.
The Nextcloud container is connected to the network via a user defined bridge network called docker_lan. This has subnet 172.20.250.0/24 and is attached to interface bond0. The container itself has IP address 172.20.250.1.
The host is Ubuntu 22.04 and has all vlans available as sub-interfaces being bond0.200, bond0.210, bond0.220 and bond0.230. The interface bond0 is based on enp1s0 and enp5s0. This bond0 has IP address 192.168.139.250.
The Nextcloud container uses the same IP address and is reachable via TCP port 443. The container image is “linuxserver/nextcloud:latest” and is updated weekly via Watchtower.
This IP address is part of the management vlan/subnet being 192.168.139.0/24.
I have read the networking docs about the different types of vlan options. But I don’t recognize the use-case described above.
What would be the recommended approach to make this happen?
Hi @nogneetmachinaal,
I am no network expert at all and I am struggling with vlan-issues as well. Perhaps, this might help you to get one step closer to your solution…
I have 3 docker containers, which need to be able to talk to each other and only one of them is supposed to be accessable from outside the host.
I am using a compose.yaml to create the containers. Nevermind all the details, only have a look at the network-specifications within the yaml. I don’t see, why this shouldn’t work with several “external” networks as well.
It looks like this is solved by using the host network and creating multiple bridge or mac-vlan networks with one container. The first one indeed works as expected - the apps from the different containers are avilable in all vlans.
Since I’m happy with I the it works when utlizing the host network I didn’t try any of the other options.