Running Containers with Separate IPs & VLANs on TrueNAS

Hi,

I’ve been searching extensively for a way to run different apps/containers on TrueNAS while assigning each its own IP address—possibly even placing them in a separate VLAN. However, I haven’t found a clear solution yet.

If you could make a video on this topic, it would be incredibly helpful!

From my research, I’ve come across macvlan, but I’ve read that using it would prevent containers from communicating with each other. Is that correct?

I’ve also considered adding a second network interface to my TrueNAS hardware and using that as the “host” for these containers. Would that be a viable approach?

The reason for this setup:

I want certain apps to route their internet traffic through a VPN. Since this is a network-related configuration, I would prefer to handle it at the router level.

I currently have a UDM-Pro, so my thought process is:

  1. Set up a VPN client on my router.
  2. Route all traffic from a specific VLAN (the one hosting these containers) through that VPN.

Would love to hear your thoughts on the best way to achieve this. If LTS could make a video covering this topic, it would be greatly appreciated!
(maybe with the app qBittorrent)

Thanks in advance!

The only way I have been able to do this successfully is to run multiple docker host VMs (in Proxmox) and assign each VM to the desired VLAN. I am curious to see if someone has a better way.

There is no official support in TrueNAS for that feature at this time.

In TrueNAS you would need to create a IP Alias. After doing this you can launch a docker app via the command line using docker compose or through the web ui using the custom docker app option and pasting in a compose config.

In the “ports” section, you would then assign the app to listen on the port of the IP Alias you setup. For example, if your TrueNAS machine is on 192.168.30.1, and you setup an alias of 192.168.30.2, you would assign an application listening on port 80, by using “192.168.30.2:80:80” to have the app broadcast on port 80 of the IP alias of 192.168.30.2.

I saw postings that this feature of allowing apps to run on other IP Alias’ is coming to the web ui in the upcoming Fangtooth release.