Dual ISP connection on one computer

Hi I have a Debian 11 (64-Bit) machine which I have installed docker latest and is running in swarm mode. This computer has two physical network connections. One of the network is which connects to Frontier internet. And the second network is which connects to Xifinity internet. Both connection have internet.

In Docker compose how can I tell my container to use internet from (Frontier ISP) and the other container to use internet from (Xfinity ISP)? In other words choose which container uses which ISP to connect to the internet. All my computers has this setup.

Thank you.


In your ports section, you can define ip also, like:


I don’t know exactly because I haven’t done it but I am pretty sure you cannot do it with only docker compose. In this case you have Docker Swarm, which complicates things more. You can try to configure macvlan networks for your containers but that can cause other issues or you can try to use iptables to change the routing on the host. I am not good at iptables so I can’t give you the final solution.

That is for incoming traffic on a specific host interface. The outgoing traffic still goes on the default route, and if is the ip address of the router (which probably the case) and not the host, Docker will not be able to forward port from that IP.