How to limit container root disk size?

Hi, I had a few containers running in a host. I wanted to limit one of the container root disk size. However, when i run the command below, it said “device doesnt exist”. I assume this is because the root disk is inherited from profile ‘default’. Because this profile is used by all container in the host, is it possible to just limit a specific container size instead of all?
lxc config device set my-container root size 20GB

some environment information
driver: lxc
driver_version: 3.0.3
kernel: Linux
kernel_architecture: x86_64
kernel_version: 5.0.0-1025-gcp
server: lxd
server_pid: 1060
server_version: 3.0.3
storage: zfs
storage_version: 0.7.12-1ubuntu5
server_clustered: false

Yes you can do this:

lxc config device override <container> root size=20GB

This copies the root device from the profile into the container and then modifies the size key.

1 Like

Thanks. It works. :grinning:

1 Like