Container or virtual machine: the one sentence difference and its four consequences

The choice is usually made out of resource habit. Yet the difference sits in a single sentence, and everything else follows from it.

AtlasPVE ·

This entry answers

  • proxmox lxc vs vm
  • proxmox container or virtual machine
  • proxmox lxc advantages
  • which should i choose in proxmox
  • is proxmox lxc secure

You are about to run something new on Proxmox and there are two options. Both run a Linux, both sit side by side in the panel, both look like they do the same job.

The choice is usually made out of resource habit: "a container is lighter". True, but that is not what should decide it.

The difference sits in one sentence: a virtual machine brings its own kernel, a container uses the server's. Everything you need to know follows from that sentence.

First consequence: where the boundary runs

A virtual machine's boundary is drawn by hardware. A container's boundary is drawn by the server's kernel.

This does not mean a container is "weak"; it means where the boundary runs. If a fault in software inside a container wants to reach the server, what it has to get past is the server's own kernel. In a virtual machine, what it has to get past is a wall at the hardware level.

The practical question is this: how much do you trust the thing you are about to run? For a service you wrote yourself or have used for years, a container is perfectly suitable. For something you downloaded and do not fully understand, a virtual machine is the better place.

Second consequence: not everything runs in a container

Nothing that needs its own kernel runs in a container. Software that wants a different kernel version, a tool that loads kernel modules, an operating system that is not Linux: all of them require a virtual machine.

This is not a matter of preference, it is a direct consequence of the sentence above. If a container uses the server's kernel, you cannot ask it to change that kernel.

Third consequence: maintenance touches them differently

This is the least known one and the one most likely to hurt.

When you update the virtual machine engine, running machines are not affected. The new engine applies to machines started after that update. So a maintenance night can pass quietly over your running machines.

When you update the container runtime layer, running containers can be affected, because they all share that layer. During the update the shared filesystem layer can be remounted and brief access errors can appear inside the containers.

This is not a product opinion, it is the direct consequence of the same single sentence: if you update something shared, everyone sharing it feels it.

Fourth consequence: freedom of movement

A virtual machine can be moved to another node while running. A container cannot: it is shut down, moved, and started again.

So if work that tolerates no interruption sits in a container, that work will stop on maintenance nights. This is something to weigh when deciding placement.

The practical rule

Choose a container when what you are running is an ordinary Linux service you could otherwise run on the server, when you trust it, and when it can take a brief interruption.

Choose a virtual machine when its own kernel is needed, when it must not be interrupted during maintenance, or when you do not fully trust what you are running.

The resource difference comes after those three tests. It is true that a container uses less memory, but the cost of a container sitting in the wrong place is many times that saving.

What Atlas does

Atlas carries this distinction not as a slogan but as behaviour.

In the update assessment, the virtual machine engine and the container runtime layer are handled separately. When the virtual machine engine is updated, the answer given for running machines is at the informational level: they are not affected, the new engine applies to ones started later. When the container layer is updated, the level rises to a warning and the reason is written out: the shared layer can be remounted, consider stopping critical containers briefly.

The same distinction appears in migration planning: for containers, migration while running is not offered as an option, the shut down, move, start chain is stated instead.

So the product does not present the two as "two flavours of the same thing". They behave differently, therefore they are described differently.

Sources

Proxmox's own documentation. In English, and it has the final word on this subject.

Related entries

How does this look inside Atlas?

Go to the product page