Is it possible to access mptcp sysctl inside docker?

370 Views Asked by At

I would like to access sysctl -n net.mptcp.mptcp_enabled from docker container, but currently I couldn't achieve it. I already tried the below things.

1.

docker run -d --sysctl net.mptcp.mptcp_enabled=1 --name=test -p 3100:3100 my_container

75dcbdc65a1539ce734a413cb6e23bf216aea76f6533c52280d3e866270424b9
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: write sysctl key net.mptcp.mptcp_enabled: open /proc/sys/net/mptcp/mptcp_enabled: no such file or directory: unknown.
docker run -d --cap-add=SYS_ADMIN --privileged  --name=test -p 3100:3100 my_container

This time container starts but there is no file under /proc/sys/net/mptcp/mptcp_enabled

3.

docker run -d -v /proc:/proc --cap-add=SYS_ADMIN --privileged  --name=test -p 3100:3100 my_container

This is also the same as 2.

I saw that a sysctl that starts with net.* are namespaced but wonder why this is not working.

Note: My host machine has mptcp supported kernel and I can see all mptcp related files under /proc/sys/net/mptcp/*

1

There are 1 best solutions below

0
On

I faced the same issue. Using --net=host should solve it.

Try this:

docker run -d --net=host --name=test -p 3100:3100 my_container