Preserve gateway for container [SOLVED]

I have very simple use-case, but can’t figure out how to achieve desired result.
Sometimes I’m connecting to VPN and eventually noticed, that containers then works through tunnel too. Obviously, it’s because on host changes default gateway.
But how to preserve (force) default gateway for containers? I don’t want to change externally visible container IP.
My setup is very simple: host network is, gateway is (default for D-Link router), and containers network just bridge:
“Config”: [
“Subnet”: “”,
“IPRange”: “”,
“Gateway”: “”

I don’t know how to route SOME traffic locally…

it IS doable, as when I worked at home, i printed to my local Lan printer by IP address while connected to the corp VPN.

Yeah, it should be doable. What I’m looking for is how to specify default gateway for docker service instead of using system gateway.
I’m tried to force all traffic through router by
iptables -t nat -A PREROUTING -s -j DNAT --to-destination
iptables -t nat -A POSTROUTING -j MASQUERADE
But seems it does not work, and my knowledge of routing and iptables fairly poor.

Solved it by:

echo “200 docker” >> /etc/iproute2/rt_tables # create table
ip rule add from table docker # assign network for it
ip route add default via dev enp2s0 table docker # assign gateway for table
ip route flush cache
Now docker always go through (LAN gateway).

great, thanks for the feedback