VPS on LXC: a container on a modern kernel and where its limits lie
LXC is containers built into the regular Linux kernel. They are assembled from standard kernel mechanisms: namespaces to isolate processes and networking, and cgroups for memory and CPU limits. Hosts most often provide them through Proxmox VE, where they are called CTs, or through LXD and Incus. As with OpenVZ, all customers on a server run on the host's single kernel, but here it is a standard kernel from a recent branch rather than a special build based on old RHEL. That is the source of both its main advantages and its main limitations.
How LXC differs from a virtual machine
A container starts in seconds, spends almost no resources on virtualisation and gives good disk speed: files sit directly in the host's storage, without an emulated disk layer. In return, you don't control the kernel.
- You can't load kernel modules. Only what is loaded on the host works. If the host has loaded the WireGuard module, you can create an interface for a private network right in the container; if not, you are left with a userspace implementation via TUN, and only if the host allows it.
- No swap of your own. The host manages swap through cgroups, and the
swaponcommand won't work inside the container. - Linux only. Windows, FreeBSD and custom ISOs are unavailable, and the choice is limited to the host's templates. There is no nested virtualisation either.
- Some system settings are locked. You can't change the system time, many sysctl parameters or the host's network stack, and iptables and nftables work only within the container's network namespace.
There is also a difference between privileged and unprivileged containers. In an unprivileged one, the root user inside the container maps to an ordinary user on the host: this is safer for all customers on the node, and most hosts provide exactly this kind of container. The downside is that some file-system operations, such as mounting NFS or CIFS from inside, won't work without help from support.
Docker inside LXC
Docker starts in an LXC container if the host has enabled nested containers: in Proxmox this is the nesting option, sometimes together with keyctl. On recent kernels Docker uses the overlay2 driver and works fine for a typical stack of a web server, a database and a couple of services. Limitations appear when a container needs host privileges: device passthrough, custom networks with special modules, changing kernel parameters. If Docker is the foundation of the project, a machine with its own kernel is more dependable: the VPS for Docker selection takes this requirement into account.
How many resources you really get
Limits in LXC are set through cgroups and enforced strictly: the container won't get memory beyond its limit, and when it runs short the kernel kills a process inside the container. Overselling here mostly concerns CPU and disk, which are shared between neighbours. Note a subtlety with how resources are displayed. Without the lxcfs component, the free, top and nproc commands show the memory and cores of the whole host, not your limits. Programs that tune themselves by these numbers (JVMs, databases, build tools) may set buffers too large and crash. The real memory limit is visible in /sys/fs/cgroup/memory.max on systems with cgroups v2.
How to check that a plan runs on LXC
Run systemd-detect-virt: in an LXC container the result is lxc (or lxc-libvirt for containers under libvirt). The uname -r command shows the host kernel; a -pve suffix hints at Proxmox. Another sign: cat /proc/1/environ | tr '\0' '\n' | grep container shows the variable container=lxc. If you expected a full machine and the system reports a container, that is a reason to talk to support while the refund period is still running.
What LXC is good for, and what it isn't
LXC is good for light tasks on modern software: a site on nginx and PHP, a bot, a small Node.js or Python service, a proxy for internal services, a monitoring server, a test environment. Compared with OpenVZ, the kernel here is recent, which means current distributions and programs that need new system calls will work. Another plus is backups: a container snapshot on ZFS or LVM storage is created almost instantly and restoring takes minutes, so many hosts include daily backups right in the plan. Ask whether they are stored on a different server.
Don't choose LXC if you need Windows, your own kernel version, your own modules, full control over networking or running virtual machines. In those cases take a VPS on KVM: the price difference is usually small, and moving a growing project costs more than picking the right platform from the start.