sysctl config, how does it works in LXC?

Egner

Renowned Member
Aug 2, 2015
96
1
73
Hi,

What i want is to put this values direcly in to all lxc containers.

net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 33554432
net.core.wmem_default = 33554432
net.core.optmem_max = 40960
net.ipv4.tcp_rmem = 4096 87380 33554432
net.ipv4.tcp_wmem = 4096 65536 33554432

Does it works like i add this to the hosts /etc/sysctl.conf and all LXC containers under that host will have that values?

I read something about that lxc have there own userspace. But if i tried to add this to the sysctl.conf inside the container i get this error message:

sysctl: cannot stat /proc/sys/net/core/rmem_max: No such file or directory
sysctl: cannot stat /proc/sys/net/core/wmem_max: No such file or directory
sysctl: cannot stat /proc/sys/net/core/rmem_default: No such file or directory
sysctl: cannot stat /proc/sys/net/core/wmem_default: No such file or directory
sysctl: cannot stat /proc/sys/net/core/optmem_max: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/tcp_rmem: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/tcp_wmem: No such file or directory

Thanks for your help :)
 
These are kernel values, LXC containers do not have a kernel, so you need access to host kernel. Either a privileged container, or, if you say you want these in all containers, just set them on host.
 
Sigxcpu, thanks for you fast answer, then i basically add this values for all hosts (physical) and all containers will get this?
 
Last edited: