[lxc-users] Mounting a swap file inside a container

Serge E. Hallyn serge at hallyn.com
Thu May 25 13:19:09 UTC 2017


Quoting Mark Constable (markc at renta.net):
> Is it possible to mount a swap file inside a zfs loop based container?

Think you'd still need something like
 https://lists.linuxfoundation.org/pipermail/containers/2008-April/010954.html
to make that feasible.

> If so, how would I first disable the host swap inside a container?
> 
> I tried this...
> 
> lxc profile set medium limits.memory.swap false
> 
> which gets me this profile...
> 
> ~ lxc profile show medium
> config:
>   limits.cpu: "2"
>   limits.memory: 512MB
>   limits.memory.swap: "false"
> description: ""
> devices:
>   eth0:
>     nictype: bridged
>     parent: lxdbr0
>     type: nic
>   root:
>     path: /
>     pool: pool50GB
>     size: 5GB
>     type: disk
> name: medium
> used_by:
> - /1.0/containers/c8
> 
> but the host swap is still mounted inside the container.
> 
> Or, is there a better strategy to provide per-container swap limits?
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list