Linux下对socket进行抓包

来自三线的随记

参考: https://superuser.com/questions/484671/can-i-monitor-a-local-unix-domain-socket-like-tcpdump

// backup the socket
mv /var/run/docker.sock /var/run/docker.sock.original

// use tcp port 8089 proxy the original socket
socat TCP-LISTEN:8089,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock.original

// use the new socket to proxy the 8089 port
socat UNIX-LISTEN:/var/run/docker.sock,fork TCP-CONNECT:127.0.0.1:8089
tcpdump -i lo -netvv port 8089