0

I'm running an lxc container through libvirt.

First I've created a container with lxc-create -n test-container -t download -- -d ubuntu -r focal -a amd64

Then I create a new virsh guest with virsh -c lxc:// define test-container.xml where the contents of test-container.xml is the following:

<domain type='lxc'>
  <name>test-container</name>
  <memory>327680</memory>
  <os>
    <type>exe</type>
    <init>/sbin/init</init>
  </os>
  <vcpu>1</vcpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
    <filesystem type='mount'>
      <source dir='/var/lib/lxc/test-container/rootfs'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <console type='pty'/>
  </devices>
</domain>

I was able to limit memory and cpu but since container filesystem is a directory on a host machine and not a qemu image, I was wondering if it is possible to limit the container filesystem size in some way ?

Thanks in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.