Routing containers on same host into several wans


I’m wondering if there is a way to do this feature.

My network is using a opnsense router and has 2 internet connection (ISP and 4G).
LAN Network is, I can easily route traffic from computers from this lan by adding rules in this router regarding their ip (for instance goes to ISP and goes to 4G)

I have a dedicated computer on the LAN that run a docker host. Lets say its IP is

Lets say now I have 2 containers A and B running on this host with their own network and ip (docker stacks), for instance and Of course those IP are only accessible from docker host, the router does not know anything about them.

My question is, is there a way to route the trafic concerning A into ISP and concerning B into 4G ?

I believe it is more a network question (how to make visible those 2 networks on my LAN) than a docker question, but in case there is something that can be done on docker side and help this, I just need some hints, I can then dig then on tutorials and docs if I have something to focus on.

Many thanks for your time.

For clarification, here is an extract of network configuration section in the docker-compose.yml I’m using for both stacks A and B ( and for the 2 files)

driver: bridge
driver: default
- subnet: