zoukankan      html  css  js  c++  java
  • Moving docker images location to different partition

    By default docker will put all the data including images under /var/lib/docker(At least on Debian). This could let to problems with space. It's the case on my home server so i had to move docker location. I had to mount /var/lib/docker to new place. Because my /var and /usr are mounted to different partitions and discs i try to solve space problem by mounting docker default location to new mount under /usr/local/docker transparently.

    First backup of fstab

    sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)  
    

    Then stop docker and copy all files per rsync preserving all attributes.

    sudo service docker stop  
    sudo mkdir /usr/local/docker  
    sudo rsync -aXS /var/lib/docker/. /usr/local/docker/  
    

    Now it was important to check that everything was copied right. I've did eye check, but diff -r command is useful to. Ok it's important to make new mount and make it durable in fstab. That is what was useful in my case inside of fstab.

    # <file> <system> <mount point>   <type>  <options>     <dump>  <pass>
    # ...
    /usr/local/docker /var/lib/docker none bind 0 0
    

    Now mount of new configuration without reboot.

    mount -a  
    

    And your docker has enough space again!

    #参考#

    http://alexander.holbreich.org/moving-docker-images-different-partition/

  • 相关阅读:
    xplan.sql(本脚本获取执行计划显示执行顺序)
    闪回查询(SELECT AS OF)
    闪回事务查询
    闪回版本查询
    闪回数据库
    shell循环语句
    前后端交互json字符串
    element vuex 语音播报
    highcharts中数据列点击事件
    highcharts为X轴标签添加链接
  • 原文地址:https://www.cnblogs.com/lishidefengchen/p/10564787.html
Copyright © 2011-2022 走看看