DOCKER - 9 Conteneur vs VMs

Search the internet for a container definition and you'll quickly stumble on people comparing containers to virtual machines. There are some surface similarities, but the two concepts are fundamentally different. A container is not a VM — it is simply a process running on your operating system, scoped and restricted by the kernel. Once you internalise that, Docker becomes much easier to reason about.

A container is just a host process

Let's prove it with MongoDB. We launch a Mongo container in the background:

docker container run --name mongo -d mongo
docker container top mongo

The docker top command lists the processes running inside a specific container. For our Mongo container, you'll see a single process named mongod. Running ps aux on the host machine shows the very same mongod process in the global process table — proof that it is a regular Linux process, not something hidden inside an inaccessible virtual machine.

  • docker container stop mongo — stop the container; docker ps no longer lists it
  • docker container top mongo on a stopped container returns nothing
  • docker container start mongo resumes it, much like resuming a suspended process

After restarting, docker ps shows it running again and docker top mongo reveals mongod alive once more. This simple demonstration is enough to anchor the right mental model: containers are restricted, namespaced processes — lightweight, fast to start, and free of the overhead of a full guest OS.