執(zhí)行命令
docker inspect -f '{{ .Mounts }}' $(docker ps -q)
這個命令的工作原理如下:
docker ps -q:列出所有正在運行的容器的ID。
docker inspect:檢查每個容器的詳細信息。
-f:指定輸出格式。
{{ .Mounts }}:這是Go模板字符串,它提取掛載信息

image.png
輸出格式:
[{Type=bind Source=/host/path Destination=/container/path ...}]
[{Type=bind Source=/other/host/path Destination=/other/container/path ...}]
...
其中Source是宿主機上的路徑,Destination是容器內的路徑。這樣,您就可以看到容器使用的文件的服務器絕對路徑。