Docker

作者: michael_jia | 来源:发表于2021-11-20 15:39 被阅读0次

    Docker 每个命令、每个选项,都有详尽的解释。

    Glossary
    docker inspect:Return low-level information on Docker objects
    • docker inspect [OPTIONS] NAME|ID [NAME|ID...]
    docker run:Run a command in a new container
    • $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
    • --name <container-name>: 指定 container name。Container identification 的一种。
    • -v 参数 VOLUME (shared filesystems)
      --volume=[host-src:]container-dest[:<options>]
    1. The host-src can either be an absolute path or a name value. If you supply an absolute path for the host-src, Docker bind-mounts to the path you specify. If you supply a name, Docker creates a named volume by that name.
    2. The container-dest must always be an absolute path such as /src/docs.
    • --mount 键值对,type 有3种值:bind, volume, tmpfs。
      • 使用 docker inspect <docker-name> 命令验证 bind mount 是否正确创建,查看 Mounts 部分。
    bind-mount、volume、tmpfs-mount
    Storage overview: Manage data in Docker
    • Use bind mounts
    • Use volumes
      Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
    • Use tmpfs mounts
      As opposed to volumes and bind mounts, a tmpfs mount is temporary, and only persisted in the host memory. When the container stops, the tmpfs mount is removed, and files written there won’t be persisted. 用于临时存储敏感文件等。

    相关文章

      网友评论

          本文标题:Docker

          本文链接:https://www.haomeiwen.com/subject/wmvdettx.html