search

Home  >  Q&A  >  body text

各位用docker的朋友,你们是否为/var/lib/docker独立分配一个分区呢?

赶脚镜像一多,数据量挺大的啊:(

伊谢尔伦伊谢尔伦2759 days ago706

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-25 09:05:29

    On production servers yes.

    reply
    0
  • 滿天的星座

    滿天的星座2017-04-25 09:05:29

    It does not have to be an independent partition, you can also modify this line by using --graph参数来指定存储路径。
    或者使用systemd来管理服务, 就在docker.service at startup:

    ExecStart=/usr/bin/dockerd --graph=/path/to/docker/dir -H fd://  

    Execute after restartingsudo docker info | grep "Root Dir", you can see that the root path has changed.

    reply
    0
  • 高洛峰

    高洛峰2017-04-25 09:05:29

    The main problem is not the image, but the running container uses this directory by default. Therefore, if there are log files written inside the container, or other production running data will affect the /var/lib/docker directory. Therefore, the production environment needs:

    1. Regularly clean up useless images
    2. Regularly clean out launched containers
    3. /var/lib/docker Make independent directory partitions, preferably using SSD disks
    4. The method provided by the system above is also good.

    reply
    0
  • Cancelreply