No, they don't serve the same purpose. Try running a Microsoft Exchange in a Docker container on a Linux server. Then try running it in a Windows VM on a Linux server.
Even if they don't always serve the same purpose, they serve a similar purpose in a number of examples. It's still a valid analogy to get someone thinking about how they might work.