Docker Community Forums

Share and learn in the Docker community.

AF_PACKET socket within the Docker container


(Alexey Lykhosherstov) #1

Hi guys,
I faced an issue, when i tried to launch my app, that captures some packets from the host using AF_PACKET socket. I get “Socket creation error (1): Operation not permitted” and the sample of the code looks like the following:
int fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_IP)); if (fd < 0) { ERROR_MSG("Socket creation error (%d): %s", errno, strerror(errno)); }

I suspect this is a config issue, since it works on the real Ubuntu 14 host.
Arguments i passed to the run command are
docker run --name test --privileged=True --net=host test/testimage

Can you please give me a hand with this?