LXC CPU pinning


Feb 10, 2020

I met a requirement to pin some container to certain CPU cores forever. This comes from the specific software we installed into the container and its licensing model. It checks CPUs and if it finds any dissimilarity with license file, it refuses to use that license file.

My machine has 24 cores, but only 10 of them are given to the container. And each time I start container it sees different 10 cores. The software seems to record which cores are in use during license activation, and after container restart it finds another set of cores.

Currently I have SMT (hyperthreading) disabled, but it would be nice to also know how to deal with it enabled.

How can I pin a container to certain CPU cores? I use PVE 7, CT is Debian 10 (due to this specific software support).

I've seen some messages in this forum that might be relevant:
but I can't fully understand them. I think lack the required expertise in cgroups, LXC and systemd. Is it possible to encode everyting into CT configuration file (and, probably, the files referenced from it, but then it is unknown how to backup them together with the container)?
Last edited:

you can add the following to your container configuration:
lxc.cgroup2.cpuset.cpus: 0-10

will pin the cores 0 to 10 for that container. please make sure you have latest version of pve-container as there was a bugfix related to rebalancing cpu cores on cgroupv2 recently (version 4.1-1 has the fix)


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!