docker 容器根目录挂载点 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jeffsun
V2EX    Docker

docker 容器根目录挂载点

  •  
  •   jeffsun 2019-04-25 17:07:47 +08:00 6361 次点击
    这是一个创建于 2411 天前的主题,其中的信息可能已经有所发展或是发生改变。

    各位大佬好,有个 docker 的问题,我启动了一个容器 CONTAINER ID 是 0175c5ff2987,通过 df -h 知道这个容器根目录是挂载到 overlay 40G 24G 14G 64% /var/lib/docker/overlay2/eeac18aa0f9bbec7d6b99081ad09dda2e4d0626793de214dde2d154655fa115e/merged。请问如何吧容器 ID 和宿主机挂载点关联呢,比如本地启动了非常多的容器,怎样快速找到某个容器根目录的挂载点。

    2 条回复    2019-04-26 18:30:33 +08:00
    senghoo
        1
    senghoo  
       2019-04-25 17:19:30 +08:00   1
    docker inspect 命令了解下
    kingfsen
        2
    kingfsen  
       2019-04-26 18:30:33 +08:00   1
    eeac18aa0f9bbec7d6b99081ad09dda2e4d0626793de214dde2d154655fa115e 这个就是容器层目录,你可以自己写个脚本,通过命令 docker inspect 0175c5ff2987 查找他们之间对应关系,首先应该了解他们之间关联。

    https://youendless.com/post/docker_storage_driver/

    通过 docker inspect 查出 Id 为镜像 id,7334cfbc206d0f0b1bb7facbef525275a23f4e4d50a37dad72f716255e39b2d6 为容器 id,8985decfb3a78124f061c6d5995a158ca7126c7ccdf4ab7d66853107fb55b4a0 则为挂载点,即容器层目录。

    "Id": "7334cfbc206d0f0b1bb7facbef525275a23f4e4d50a37dad72f716255e39b2d6",
    "Image": "sha256:94e814e2efa8845d95b2112d54497fbad173e45121ce9255b93401392f538499",
    "ResolvConfPath": "/var/lib/docker/containers/7334cfbc206d0f0b1bb7facbef525275a23f4e4d50a37dad72f716255e39b2d6/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/7334cfbc206d0f0b1bb7facbef525275a23f4e4d50a37dad72f716255e39b2d6/hostname",
    "HostsPath": "/var/lib/docker/containers/7334cfbc206d0f0b1bb7facbef525275a23f4e4d50a37dad72f716255e39b2d6/hosts",
    "GraphDriver": {
    "Data": {
    "LowerDir": "/var/lib/docker/overlay2/8985decfb3a78124f061c6d5995a158ca7126c7ccdf4ab7d66853107fb55b4a0-init/diff:/var/lib/docker/overlay2/4a00cadd4488f55ad2378a9d2d915dcff733244fc96217b89f827c5f8959b34b/diff:/var/lib/docker/overlay2/e8381b82a136d9cbad47970923b3dec9d6abaaffe08268a326ccf114a4f46d06/diff:/var/lib/docker/overlay2/c47ec19c6123f5a75d9afbe9d9a631ecaa3469ad670bbb2b1b9ce5e64e361c7d/diff:/var/lib/docker/overlay2/9955b547c10c465488960ecba07dcb8ace596c972e3ad8d391afc20cb6aab46b/diff",
    "MergedDir": "/var/lib/docker/overlay2/8985decfb3a78124f061c6d5995a158ca7126c7ccdf4ab7d66853107fb55b4a0/merged",
    "UpperDir": "/var/lib/docker/overlay2/8985decfb3a78124f061c6d5995a158ca7126c7ccdf4ab7d66853107fb55b4a0/diff",
    "WorkDir": "/var/lib/docker/overlay2/8985decfb3a78124f061c6d5995a158ca7126c7ccdf4ab7d66853107fb55b4a0/work"
    }
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     816 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 29ms UTC 20:14 PVG 04:14 LAX 12:14 JFK 15:14
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86