zoukankan      html  css  js  c++  java
  • 第 6 章 存储

    volume container

    volume container 是专门为其他容器提供 volume 的容器。它提供的卷可以是 bind mount,也可以是 docker managed volume。

    创建 volume container:

    容器名为 vc_data(vc 是 volume container 的缩写)。volume container 的作用只是提供数据,本身不需要处于运行状态。

     

    容器 mount 了两个 volume:

    1、bind mount,存放 web server 的静态文件

    2、docker managed volume,存放一些实用工具

     

    通过 docker inspect 可以查看到这两个 volume

    docker inspect vc_data

     

    其他容器可以通过 --volumes-from 使用 vc_data

    docker run  --name web1 -d -p 80 --volumes-from vc_data httpd

    docker run  --name web2 -d -p 80 --volumes-from vc_data httpd

     

     

    通过 docker inspect 可以查看到这两个容器

    docker inspect web1

     

    web1 容器使用的就是 vc_data 的 volume,而且连 mount point 都是一样的。

     

    两个容器已经成功共享了 volume container 中的 volume

     

    volume container 的特点:

    1、与 bind mount 相比,不必为每一个容器指定 host path,所有 path 都在 volume container 中定义好了,容器只需与 volume container 关联,实现了容器与 host 的解耦。

    2、使用 volume container 的容器其 mount point 是一致的,有利于配置的规范和标准化,但也带来一定的局限,使用时需要综合考虑。

     

    --------------------------------------------------引用来自--------------------------------------------------------

    https://mp.weixin.qq.com/s?__biz=MzIwMTM5MjUwMg==&mid=2653587726&idx=1&sn=d07c027d89a543f33d53c84f2c8f370b&chksm=8d308117ba4708018a568e22184893859d6d81365b2e9de9169b4d5a281947625e303be7e652&scene=21#wechat_redirect

  • 相关阅读:
    poj 1850/poj 1496
    poj 1035
    poj 3252
    hdoj 1013
    poj 2965
    poj 1844
    poj 2309
    蓝桥杯比赛回来后计划。。。
    山大实训第二周感想
    hadoop——Map/Reduce中combiner的使用
  • 原文地址:https://www.cnblogs.com/gsophy/p/10469018.html
Copyright © 2011-2022 走看看