Docker Community Forums

Share and learn in the Docker community.

How to tune kernel properties in Docker Images

I am trying to build a docker container which should have the /proc/sys/net/ipv4/tcp_* options.while building i am trying to tune the file /proc/sys/net/ipv4/tcp_rmem.

sysctl -w net.ipv4.tcp_rmem=“2097152 4093792 4093792”

when i build the docker container it is throwing an error like
sysctl: cannot stat /proc/sys/net/ipv4/tcp_rmem: No such file or directory
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/ipv4/udp_mem: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/udp_rmem_min: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/udp_wmem_min: No such file or directory

Could anyone please help me in resolving this issue?

1 Like

Maybe it’s too late for an answer, but perhaps this could help others who bump into similar issue with kernel /proc settings.

I guess a container has a virtual link to the /proc path of the host it’s running on. It’s automatically mounted into the container.

In my case, an app warns that /proc/sys/net/core/rmem_max and /proc/sys/net/core/wmem_max must have values greater than the default. I edit /etc/sysctl.conf on the host it’s running on to add the following:

# Allow a 25MB UDP receive buffer for JGroups  
net.core.rmem_max = 26214400  
# Allow a 1MB UDP send buffer for JGroups  
net.core.wmem_max = 1048576

I run sysctl -p, then I deploy the app. The app stops giving me the warnings.

This solution works for someone? I tried without changes.