How can I use the host Swap memory in an LXC/LXD container?

Hi, I have a recent installation of debian+LXD(debian) but I would like to know how I can take advantage/use the Swap memory of the host so that it can be used by the container.

I am testing with a 1GB ram instance with 5GB of swap with the host, but it is necessary that the container can take advantage of the swap memory of this host.

The only relevant load on the host is the container.

I have searched, but the solutions found do not work.

Thank you very much for your help.

1 Like

Containers will use the swap of the host (if needed) as part of their memory limits specified using limits.memory.

See also the swap.* settings in https://linuxcontainers.org/lxd/docs/master/reference/instance_options/