![lsof 可以显示真实路径而不是 docker 容器的绑定挂载路径吗?](https://linux22.com/image/211815/lsof%20%E5%8F%AF%E4%BB%A5%E6%98%BE%E7%A4%BA%E7%9C%9F%E5%AE%9E%E8%B7%AF%E5%BE%84%E8%80%8C%E4%B8%8D%E6%98%AF%20docker%20%E5%AE%B9%E5%99%A8%E7%9A%84%E7%BB%91%E5%AE%9A%E6%8C%82%E8%BD%BD%E8%B7%AF%E5%BE%84%E5%90%97%EF%BC%9F.png)
我尝试找出特定路径中正在使用哪些文件:
lsof /mnt/cache
这返回例如:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Plex\x20S 338 nobody cwd DIR 259,1 74 3221225602 /config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.system
如您所见,“NAME”不包含路径“/mnt/cache”。并且主机系统上没有任何可用的“/config”目录:
ls /config
/bin/ls: cannot access '/config': No such file or directory
这是因为 /config 是到 /mnt/cache/appdata/plex 的 Docker 绑定挂载,它仅存在于特定容器内:
docker inspect plex
...
"Mounts": [
...
{
"Type": "bind",
"Source": "/mnt/cache/appdata/plex",
"Destination": "/config",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
可以lsof
显示真实的源码路径,所以是这样的?
Plex\x20S 338 nobody cwd DIR 259,1 74 3221225602 /mnt/cache/appdata/plex/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.system