[lxc-users] Number of core for a container

Stéphane Graber stgraber at ubuntu.com
Mon Nov 6 19:23:12 UTC 2017


Those instructions are for LXD, not for low level LXC.

For LXC, you'd need to use the lxc.cgroup.cpuset config keys to directly
configure the cpuset cgroup.

Note that since LXC doesn't have a long running manager like LXD does,
you're going to need to do the scheduling/balancing of those containers
yourself.

On Mon, Nov 06, 2017 at 05:20:32PM -0200, Renato dos Santos wrote:
> Hi Thouraya,
> 
> You can use this after create the container:
> 
> Set the container to use any 2 CPUs on the host.
> 
>     $ lxc config set your-container limits.cpu 2
> 
> Set the container to use physical CPU 0, 3, 7, 8 and 9 on the host.
> 
>     $ lxc config set your-container limits.cpu 0,3,7-9
> 
> Set the container to use 20% of the available CPU on the host or more if
> it’s available.
> 
>     $ lxc config set your-container limits.cpu.allowance 20%
> 
> Set the container to use no more than 50% of the available CPU on the host,
> or 100ms for every 200ms of CPU time available.
> 
>     $ lxc config set your-container limits.cpu.allowance 100ms/200ms
> 
> other option, use the profile.
> 
> 
> On 06/11/2017 16:40, Thouraya TH wrote:
> > Hi all,
> > 
> > Please, how can i fix number of cores (CPU) for a container when i use
> > lxc-create or lxc-clone ?
> > 
> > Thanks a lot for help.
> > Best reagrds.
> > 
> > 
> > 
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> 
> -- 
> Renato dos Santos
> Analista de Infraestrutura
> 
> 48 3239-2400 Pabx
> WPLEX Software Ltda.
> Rodovia SC 401, 8600 Corporate Park Bloco 5 Sala 101
> 88050-000 Santo Antônio de Lisboa, Florianópolis SC
> wplex.com.br <http://wplex.com.br>
> WPLEX

> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20171106/0e4b6085/attachment.sig>


More information about the lxc-users mailing list