If your goal is to use a separate environment for isolation of libraries, dependencies, etc. then yes, you can use either VMs or containers for this purpose. However, they're not without their caveats.
Virtual Machines add the overhead of an entire additional operating system, but it much closer mimics what a user would see on their own environment. So, you would need a powerful enough computer to run two operating systems: one for your development, and one for executing your game.
Containers are much lighter weight (and you can run containers on Windows, now, too!) but with the caveat is that they're not exactly a full replica of the target environment.
With either of these solutions, keep in mind that it's a bit of a project to get high-performance video as well as audio (with specific hardware acceleration that you might want), as they typically abstract specific hardware and treat it as more generic hardware.
It is likely possible to address these issues (YMMV, depends on specific manufacturers of your audio/video hardware, drivers and compatibility, etc.), but some folks have issues running games in VMs and containers for exactly this reason.
For example, speaking of Hyper-V since you brought it up, see this post:
I setup Win 7 in a windows 2008 r2 x64 with hyper-v but I can't add
any sound device in win7 VM, Would somebody help me?
Hyper-V doesn't provide a virtual audio device. If you want audio, you need to use RDP to get the virtual audio support working.
However, VMConnect (likely much more recent than the earlier post) appears to allow you to use local devices in Hyper-V, such as USB drivers and audio hardware.
You will likely need to spend some time investigating whether it's possible to support the specific hardware devices that you have in either VMs or containers, so while that would be valuable (I agree with you on the benefits), this is definitely an issue to be aware of, and budget time for, if you're interested in going down this route.
If you do manage to make this work, please write up a blog post and/or share your source code in a GitHub repo so that others can find it and benefit from this work in the future.