A virtual machine carries a whole operating system; a container carries only an application and what it needs, sharing the host's kernel.
Virtual machines give stronger isolation and any operating system, at the cost of size and start time. Containers start in seconds and pack densely, with lighter isolation.
Many teams use both: containers for their applications, running on virtual machines that form the nodes of a Kubernetes cluster.
