Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Check the CPU Limit of a Docker Container

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. Get the number in the file /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us. Denote it as cfs_quota_us.

  2. Get the number in the file /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us. Denote it as cfs_period_us.

  3. Calculate the CPU limit (set by --cpus) as cfs_quota_us / cfs_period_us.