• 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/

  • 相关阅读:
    魔兽登录系统
    航班信息查询预订
    第六章
    嵌套.
    嵌套
    Mysql
    第二章
    Java
    HTML-表格-列表-结构标记-表单
    HTML语言
  • 原文地址:https://www.cnblogs.com/lishidefengchen/p/10564787.html
Copyright © 2020-2023  润新知