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.

  • 相关阅读:
    LC 综合 中级算法笔记
    LC 212. 单词搜索2
    [NLP] 2.2 文本正规化 (Text Normalization)
    本地秘钥复制到github,实现两者之间的交互
    Python 实例化对象
    C# 左补齐+ 生成一个星期的日期
    hello world
    迭代器模式、观察者模式
    代理模式、桥接模式、装饰器模式、适配器模式
    外观模式、组合模式、享元模式
  • 原文地址:https://www.cnblogs.com/andycja/p/14125010.html
Copyright © 2011-2022 走看看