zoukankan      html  css  js  c++  java
  • Application Data in Docker 笔记

    Application Data in Docker

    By default all files created inside a container are stored on a writable container layer. This means that: The data doesn't persist when that container no longer exists, and it can be difficult to get the data out of the container if another process needs it. And is low performant.

    Advanced Types: bind, volume, tmpfs
    Volumes are stored in a part of the host filesystem which is managed by Docker (/var/lib/docker/volumes/ on Linux). Non-Docker processes should not modify this part of the filesystem. Volumes are the best way to persist data in Docker.
    Bind mounts may be stored anywhere on the host system. They may even be important system files or directories. Non-Docker processes on the Docker host or a Docker container can modify them at any time.
    tmpfs mounts are stored in the host system’s memory only, and are never written to the host system’s filesystem.

    Consider a situation where your image starts a lightweight web server. You could use that image as a base image, copy in your website’s HTML files, and package that into another image. Each time your website changed, you’d need to update the new image and redeploy all of the containers serving your website. A better solution is to store the website in a named volume which is attached to each of your web server containers when they start. To update the website, you just update the named volume.

    Multiple containers can use the same volume in the same time period. This is useful if two containers need access to shared data. For example, if one container writes and the other reads the data.

  • 相关阅读:
    parent.relativePath' points at wrong local POM
    'cmd' 不是内部或外部命令,也不是可运行的程序 或批处理文件.
    解析xml文件的几种技术与Dom4j与sax之间的对比
    html/js/css资源
    HTML编码规范
    CSS编码规范
    PCB标识说明
    sama5d3 环境检测 gpio--yk测试
    sama5d3 环境检测 gpio--yx测试
    ad7888 linux driver
  • 原文地址:https://www.cnblogs.com/andycja/p/14125010.html
Copyright © 2011-2022 走看看