Add route to host after starting an container

Hello together,
is there a possibility to add an additional route to the host table after starting a container?

I used the search of course. Similar topics are mentioned but unfortunately there are no responses.


  • Docker version 20.10.12, build e91ed57
  • installed wireguard as container (image:
  • wireguard container has IP
  • wireguard network is
  • wireguard host peer has ip
  • wireguard clients peers have 3 4 and so on
  • a standard route will be created to route from host network to container network ( →
  • Setup Is Working so far, as long as all connections are built up by wireguard clients (they can connect to NAS in home network etc)

As soon as I want to use RDP, VoIP-client or other protocols where the server (e.g. rdp server) wants to establish a connection back to the client (rdp client) the setup isn’t working anymore.

EXCEPT I activate IP forwarding and set a route to via then also RDP and so on is working.

so far so good…
but after a reboot the route disappears / is not there of course. I am not able to set the route via netplan or so because the target isn’t available.

Is there an option or possibility with docker toolset to run a script with the routing statement as soon as the wireguard container was started? Maybe I missed something.

This would be an more elegant option then to use standard linux approaches due to it relates to an docker context.

best regards and thank you for your support