LXC Tips




Kill hang container


hang 的情況

lxc-start -n sshgw -F

output & hang

lxc-start: utils.c: safe_mount: 1653 Invalid argument
     - Failed to mount /sys/kernel/debug onto /usr/lib/x86_64-linux-gnu/lxc/sys/kernel/debug

kill it

ps aux | grep lxc-start

kill -9 ??


Cleaning up LXC cgroups (remove orphaned cgroups)


# U16

manually removing all the child cgroups underneath /sys/fs/cgroup/*/lxc/<container>

find /sys/fs/cgroup/*/lxc/sshgw/ -type d | tac | xargs rmdir


Disable Container dmesg


透過 seccomp 限制 Container


syslog errno 1


Prevent process bombing


for performance reasons the kernel does not account kernel memory use unless a kernel memory limit is set.

(lxc.cgroup.memory.kmem.limit_in_bytes = number)


cat /sys/fs/cgroup/memory/memory.kmem.usage_in_bytes

cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes

cat /sys/fs/cgroup/memory/memory.kmem.failcnt

cat /sys/fs/cgroup/memory/memory.kmem.tcp.*