This is a known issue.
Until it is fixed, the workaround would be:
1 - Enable swap accounting. Add boot argument swapaccount=1 to the GRUB_CMDLINE_LINUX_DEFAULT= variable in /etc/default/grub, then run ‘update-grub’ as root and reboot;
2 - Use lxc config set containername ...
-
limits.memorymust be set to some value (percentage or fixed value) -
limits.memory.enforcemust be set tohard -
limits.memory.swapmust be set tofalse
More info here.