Containers vs. virtual machines
You’ve now gotten a taste of the workflow that you’ll use to create and work with Docker images. However, it pays to know a bit about the underlying differences between containers and virtual machines. This knowledge can make a difference when you’re troubleshooting operational issues, and it’s also a common interview question to gauge how well you understand the principles underlying containerization.
Virtual Machines (VMs) allow you to run complete operating systems like Linux, Windows, or DragonFly BSD on top of another host operating system. VMs run independently of the host system. In fact, running Docker on macOS will transparently use a VM to provide the Linux OS that’s needed for Docker.
As a result, a virtual machine runs a full operating system like Linux, which in turn uses an init system like systemd
. Because of this, you manage services and processes exactly as if your VM were a physical machine...