On Thu, Nov 1, 2018 at 8:55 AM, kemi <[email protected]> wrote:

> Hi, Everyone
>    I am new comer of LXC/LXD community, and want to run a container on a
> limited cpu set.
>
>   The followings are my steps:
>   a) lxd init
>   b) lxc launch Ubuntu:18.04 first
>   c) lxc stop first
>   d) lxc config set first limits.cpu 0  // set container running on CPU 0
>

I'm not sure, but I believe "0" here means all cpu, and not pin to cpu 0?

Try changing this to "1", "0-0", and "1-2". Observe the difference.


>   e) lxc start first
>   f) lxc exec first -- bash
>   g) nproc   // the expected result would be 1, however, it still equals
> to cpu number of host
>   h) ls /sys/devices/system/cpu   // the expected result should only
> include cpu0 directory, however, it's not
>
>

g) and h) read files from /proc, not cgroup. You need lxcfs. You should
already have that on ubuntu though.



> So, it seems that CPU cgroup has not been enabled in LXC/LXD, right?  The
> version of lxc is 2.0.11 on Ubuntu 16.04.
> Anyone can help me on that, thx very much.
>

If this is a new install, I highly suggest you just switch to ubuntu 18.04
+ lxd-3 host.
If you simply want to have "correct" /proc entries, make sure lxcfs is
installed, and then restart lxd (if needed).

-- 
Fajar
_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to