• bindMountContainerRootfs


    root@ubuntu:/home/ubuntu# mount | grep overlay | grep docker | grep merged | grep 761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3
    overlay on /var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/merged type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off)
    root@ubuntu:/home/ubuntu# mount | grep overlay | grep kata | grep rootfs | grep 761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3
    overlay on /run/kata-containers/shared/sandboxes/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/mounts/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/rootfs type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off)
    overlay on /run/kata-containers/shared/sandboxes/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/shared/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/rootfs type overlay (rw,relatime,
    lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,
    upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,
    workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off) root@ubuntu:/home/ubuntu#

     

    bindMountContainerRootfs: 将/var/lib/docker/overlay2/container_id/merge 通过mount bind挂载到/run/kata-containers/shared/sandboxes/sandboxId/shared/containerId/rootfs

    func bindMountContainerRootfs(ctx context.Context, sharedDir, sandboxID, cID, cRootFs string, readonly bool) error {
        span, _ := trace(ctx, "bindMountContainerRootfs")
        defer span.Finish()
    
        rootfsDest := filepath.Join(sharedDir, sandboxID, cID, rootfsDir)
    
        return bindMount(ctx, cRootFs, rootfsDest, readonly)
    }

     

    root@ubuntu:/home/ubuntu# mount | grep overlay | grep docker
    overlay on /var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/merged type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off)
    overlay on /run/kata-containers/shared/sandboxes/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/mounts/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/rootfs type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off)
    overlay on /run/kata-containers/shared/sandboxes/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/shared/fa55c7478feb846f8ea41fe52cb13252afb0df1ee09b4cc7a1d58218ed4c782a/rootfs type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/ORGFKK3IMOIFU4AZQKS3CYFZM3:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/diff,workdir=/var/lib/docker/overlay2/761dc1b5e9093b905d4d7e23b9c7a18af36874f265860095613ff83e148d8cf3/work,xino=off)
    overlay on /var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/merged type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/5Z2FKD6WOP5MZ4XKMVS44QDGOS:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/diff,workdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/work,xino=off)
    overlay on /run/kata-containers/shared/sandboxes/ef4b70596e0b829af5fd9f14343f2c92a8da3d0d22ea1f23e83b14384fa4f1cc/mounts/ef4b70596e0b829af5fd9f14343f2c92a8da3d0d22ea1f23e83b14384fa4f1cc/rootfs type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/5Z2FKD6WOP5MZ4XKMVS44QDGOS:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/diff,workdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/work,xino=off)
    overlay on /run/kata-containers/shared/sandboxes/ef4b70596e0b829af5fd9f14343f2c92a8da3d0d22ea1f23e83b14384fa4f1cc/shared/ef4b70596e0b829af5fd9f14343f2c92a8da3d0d22ea1f23e83b14384fa4f1cc/rootfs type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/5Z2FKD6WOP5MZ4XKMVS44QDGOS:/var/lib/docker/overlay2/l/NE3T6GEJZK46HVMUL27FGQDOYH:/var/lib/docker/overlay2/l/2WRKKP23NPW2ERHXFHJL57MO7D:/var/lib/docker/overlay2/l/HJZIRL54DSH6NZJJYMY5HENOZA:/var/lib/docker/overlay2/l/F6KA6O7GCJHTDFGIOM7EMH7IFR:/var/lib/docker/overlay2/l/T6LRFVAFIXJLSIZWQ25XTNXEK4,upperdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/diff,workdir=/var/lib/docker/overlay2/1c4476eff951c58a04fd1afff227d0249563966f771c579fa4a95600d8e0e691/work,xino=off)
    root@ubuntu:/home/ubuntu# ls
    containerddemo  dirA  dirB  dirC  mysock  nfsroot  overlay  qemu.sh  qemu.sh.bak  server.py  soft_s  stat.sh  test  txt  v1.18  work
    root@ubuntu:/home/ubuntu# mount | grep dirA
    overlay on /home/ubuntu/test type overlay (rw,relatime,lowerdir=dirA:dirB,upperdir=dirC,workdir=work,xino=off)
    overlay on /root/rootfs/mnt_test type overlay (rw,relatime,lowerdir=dirA:dirB,upperdir=dirC,workdir=work,xino=off)
    root@ubuntu:/home/ubuntu# umount /root/rootfs/mnt_test
    root@ubuntu:/home/ubuntu# mount | grep dirA
    overlay on /home/ubuntu/test type overlay (rw,relatime,lowerdir=dirA:dirB,upperdir=dirC,workdir=work,xino=off)
    root@ubuntu:/home/ubuntu# mount  /home/ubuntu/test   /root/rootfs/mnt_test
    mount: /root/rootfs/mnt_test: /home/ubuntu/test is not a block device.
    root@ubuntu:/home/ubuntu# mount  --bind /home/ubuntu/test   /root/rootfs/mnt_test
    root@ubuntu:/home/ubuntu# mount | grep dirA
    overlay on /home/ubuntu/test type overlay (rw,relatime,lowerdir=dirA:dirB,upperdir=dirC,workdir=work,xino=off)
    overlay on /root/rootfs/mnt_test type overlay (rw,relatime,lowerdir=dirA:dirB,upperdir=dirC,workdir=work,xino=off)
    root@ubuntu:/home/ubuntu# 

  • 相关阅读:

    HttpClient发送get/post请求
    maven创建ssm项目依赖(pom.xml文件)
    java的Scanner类总结
    java多线程总结
    java跨域问题
    Idea打包项目war并且发布到服务器
    Mybatis入门案例之增删改查
    springMVC中的@RequestBody和@ResponseBody以及@RequestParam
    Gson解析json
  • 原文地址:https://www.cnblogs.com/dream397/p/13916130.html
Copyright © 2020-2023  润新知