Permission Denied for SO_DEBUG socket option inside docker

I’ve isolated the Permission Denied exception being thrown inside one of my test case to these lines –

...
ASSERT_EQ(0, getsockopt(s.getSocket(), SOL_SOCKET, SO_DEBUG, &optval, &optlen));
...
...
ASSERT_EQ(0, setsockopt(s.getSocket(), SOL_SOCKET, SO_DEBUG, &optval, optlen));
...

These work fine while running test executable with sudo on my local machine eg. sudo ./test/testexe and all test pass, no exception is thrown. To run these without sudo, I’ve tried setting capabilities prior to executing tests eg. sudo setcap "cap_net_admin+ep cap_net_raw+ep" test/testexe which again runs fine without sudo this time on my local machine.

  • Docker Swarm shared volumes
  • How can i create a folder inside the shared volume with the correct permission in docker?
  • Installation in Intel System Studio error
  • Saving docker container image
  • Debug on Docker throws an error
  • Meaning of docker-compose exit code?
  • The problem arises with docker where none of the methods work – neither sudo helps and exception is still thrown nor does the setcap method which successfully sets the capabilities but an error Operation not permitted is shown when executing tests.

    So is there any other way of running SO_DEBUG lines successfully but without running docker with elevated privileges since I get control only inside the docker container with my CI platform.

  • Can't make nginx and php-fpm dockers communicate
  • Deploy Ansible project which include a docker-compose.yml
  • Docker Gradle project generates single JAR, but keeps rebuilding 4 layers
  • Docker Consul Multiple Containers in single VM setup
  • Unable to connect to cassandra from Docker container using spring-data-cassandra: NoHostAvailableException: All host(s) tried for query failed
  • How to profile nodejs app for memory leaks inside docker container?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.