大网数据广告活动
服务器运维问答

netstat shows connected socket with path to it, but path doesn't exist

· 52CE 我爱测

Im inside a docker container and ran netstat -x | grep docker which got me the: unix 3 [ ] STREAM CONNECTED 62288711 /var/run/docker.sock unix 3 [ ] STREAM CONNECTED 59416957 /var/run/docker.sock unix 3 [ ] STREAM CONNECTED 52070…

问题原文

原帖链接 · InsOp · CC BY-SA 4.0

Im inside a docker container and ran netstat -x | grep docker which got me the:

unix  3      [ ]         STREAM     CONNECTED     62288711 /var/run/docker.sock
unix  3      [ ]         STREAM     CONNECTED     59416957 /var/run/docker.sock
unix  3      [ ]         STREAM     CONNECTED      52070 /var/run/dockershim.sock
unix  3      [ ]         STREAM     CONNECTED      52071 /var/run/dockershim.sock
unix  3      [ ]         STREAM     CONNECTED      51987 /var/run/docker.sock
unix  3      [ ]         STREAM     CONNECTED     63299168 /var/run/docker.sock
unix  3      [ ]         STREAM     CONNECTED      52649 /var/run/docker.sock
unix  3      [ ]         STREAM     CONNECTED      42851 /var/run/docker/libcontainerd/docker-containerd.sock

But when I want to access /var/run/docker.sock or even /var/run I get

ls: /var/run/: No such file or directory

Is this some kind of security mechanism like a capability which is dropped? I wonder why netstat can point to such a path while it is not even there? Is there some other way to access this socket, since it has to be there somehow?

已采纳解答

原帖链接 · ameiji · CC BY-SA 4.0

Running this command inside a docker container shows you information about sockets in a whole system (not just inside your container). This information is available for container processes via /proc/net/unix and other similar files, which netstat uses. Therefore /var/run/... in netstat's output is a global path on your system, not available for that particular container.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。