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

Mark Constable markc at renta.net
Thu May 25 07:38:47 UTC 2017


Is it possible to mount a swap file inside a zfs loop based container?

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?


More information about the lxc-users mailing list