网站首页 文章专栏 查看docker 容器内部 tcp 连接
dd
#!/bin/bash
if [ x"$1" == x"" ]; then
echo "缺少参数1 <grep key>"
fi
for d_id in `docker ps | awk '{print $1}'`
do
echo ${d_id}
d_pid=`docker inspect -f '{{.State.Pid}}' ${d_id} `
if [ x"${d_pid}" == x"" ]; then
continue
fi
nsenter -t ${d_pid} -n netstat | grep $1
done
dd