By “Pure LXC,” I meant LXC that uses the “lxc-*” commands and not “lxc *” as used by LXD. LXC and LXD gets used interchangeable and if I search in Google or Kagi for anything related to LXC, I get search results that talk about LXD, even though I never mentioned LXD in the list of keywords. With that out of the way…
Here is the basic configuration for my LXC container:
root@vmserver:~# cat /data/vm/lxc/vyos/config
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template:
# Template script checksum (SHA-1): 47a9fc1ce184c958ecafc88dfd5f21c06f728288
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64
# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/vyos/rootfs
lxc.uts.name = vyos
lxc.start.auto = 1
lxc.autodev = 1
lxc.hook.autodev = sh -c "mknod -m 0666 ${LXC_ROOTFS_MOUNT}/dev/fuse c 10 229"
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = brVMNet
lxc.net.0.flags = up
lxc.net.0.hwaddr = 02:16:3e:08:75:40
lxc.net.1.type = veth
lxc.net.1.link = brVLabNet1
lxc.net.1.flags = up
lxc.net.1.hwaddr = 02:09:3f:04:35:70
Once I execute lxc-attach vyos
and run the free -m
command, I get this:
vyos@vyos:~$ free -m
total used free shared buff/cache available
Mem: 46068 4222 762 8 41659 41846
Swap: 8191 0 8191
Note that the used
column shows the entire host memory usage and not the container memory usage. Is there a way to show only the memory usage for the container?