With Python bindings: ``` container.set_config_item('lxc.cgroup.memory.limit_in_bytes', mem_limit) container.set_config_item('lxc.cgroup.memory.memsw.limit_in_bytes', memsw_limit) ``` generates following lines in container config: ``` lxc.cgroup.memory.limit_in_bytes = 3G lxc.cgroup.memory.memsw.limit_in_bytes = lxc.cgroup.memory.memsw.limit_in_bytes = 4G ``` And if there are other `set_config_item`s before 'lxc.cgroup.memory.limit_in_bytes': ``` lxc.cgroup.memory.limit_in_bytes = lxc.cgroup.memory.limit_in_bytes = 3G lxc.cgroup.memory.memsw.limit_in_bytes = lxc.cgroup.memory.memsw.limit_in_bytes = 4G ``` Happens on current stable-2.0 branch, haven't tested master branch yet