Docker containers behind public ip

Hello everyone! My issue is as follows: I created two containers and placed them in an L3 network. I set up a static route in my router, and I could easily reach both containers. However, now I need to run these two containers on a VM with a public IP address. What is the best way to maintain the subnet already used on another host while making it accessible via the public IP of this VM? thanks