How do I plan/choose between #VM and #Container?

I understand that a Virtual Machine (#VM) is sort of a dedicated (although virtual) computer that runs a full-blown operating system.

I further understand that a #Container is also a virtualized environment but it “lives in a pod” running in a conceptually “larger” virtual machine; so it is borrowing from that larger machine’s operating system rather than having its own operating system.

What is missing from my understanding is the practicality: At what point do I choose to use Containers over VMs? How do I develop a sense of what they are particularly good for? Obviously they share the common character of “place to run computations” but what makes one preferable to the other?

For context: I do not want to build any tricky cyberinfrastructure like a Jupyter Hub; I just want to run a set of programs rather asynchronously, working with a modest dataset of a few tens of Terabytes.