Just in case this could be your issue: in my limited experience with docker (not LXC) even when you limit the memory for the container at the host/hypervisor level is not seen from within the container like if it were a VM. The container sees the whole 32GBs of RAM your host has, if your application within the container is not limited to a lower (or at most the same) memory size limit you set on the container itself then you might run into these OOM issues. Example:
Some additional info can be found in this other thread: OOM Error For Ubuntu LXC Containers
- You create a Wireguard LXC with a memory size limit of 4GB
- When you start your Wireguard LXC container it can see the whole 32GBs of RAM of your host
- Not sure what the default amount of RAM is Wireguard configured to use, let's say 8GB (or unlimited )
- When Wireguard tries to use more than 4GBs of memory it'll be killed due to OOM by the LXC engine (due to being limited to 4GBs in its config)
Some additional info can be found in this other thread: OOM Error For Ubuntu LXC Containers