• 12. Docker修改默认存储位置


    1. 首先使用Docker info查看docker的基本信息

    bash4-.3 ~# docker info
    Containers: 0
    Images: 0
    Storage Driver: devicemapper
     Pool Name: docker-8:1-787286-pool
     Pool Blocksize: 65.54 kB
     Backing Filesystem: extfs
     Data file: /dev/loop0
     Metadata file: /dev/loop1
     Data Space Used: 305.7 MB
     Data Space Total: 107.4 GB
     Data Space Available: 50.3 GB
     Metadata Space Used: 733.2 kB
     Metadata Space Total: 2.147 GB
     Metadata Space Available: 2.147 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Data loop file: /var/lib/docker/devicemapper/devicemapper/data
     Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
     Library Version: 1.02.89-RHEL6 (2014-09-01)
    Execution Driver: native-0.2
    Logging Driver: json-file
    Kernel Version: 2.6.32-504.el6.x86_64
    Operating System: <unknown>
    CPUs: 4
    Total Memory: 19.22 GiB
    Name: vps46.timecash.cn
    ID: LGNH:GIPP:LUP5:YYDC:VKVC:PPUW:MMGR:JA4V:VFV4:7L7L:E23U:PULA
    

    可以看到docker文件存储路径为: /var/lib/docker/....作为默认存储位置

    2. 修改docker默认存储位置

    2.1 查看宿主机磁盘容量

    bash-4.3 ~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1        50G  2.3G   45G   5% /
    tmpfs           9.7G   80K  9.7G   1% /dev/shm
    /dev/sda3       858G   95M  815G   1% /data
    

    2.2 由于磁盘根分区容量不足, 将docker存储路径修改为/data目录

    bash-4.3 ~# /etc/init.d/docker stop         -> 停止Docker容器
    

    2.3 备份默认的docker存储路径复制到/data目录下, 并创建软链

    bash-4.3 ~# cd /var/lib/
    bash-4.3 lib# mv docker docker_160725
    bash-4.3 lib# mkdir -p /data/docker/var
    bash-4.3 lib# cp -r docker_160725 /data/docker/var/docker
    bash-4.3 lib# ln -s /data/docker/var/docker .
    bash-4.3 lib# /etc/init.d/docker start
    bash-4.3 lib# docker info
    Containers: 0
    Images: 0
    Storage Driver: devicemapper
     Pool Name: docker-8:3-46924001-pool
     Pool Blocksize: 65.54 kB
     Backing Filesystem: extfs
     Data file: /dev/loop0
     Metadata file: /dev/loop1
     Data Space Used: 305.7 MB
     Data Space Total: 107.4 GB
     Data Space Available: 107.1 GB
     Metadata Space Used: 733.2 kB
     Metadata Space Total: 2.147 GB
     Metadata Space Available: 2.147 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Data loop file: /data/docker/var/docker/devicemapper/devicemapper/data
     Metadata loop file: /data/docker/var/docker/devicemapper/devicemapper/metadata
     Library Version: 1.02.89-RHEL6 (2014-09-01)
    Execution Driver: native-0.2
    Logging Driver: json-file
    Kernel Version: 2.6.32-504.el6.x86_64
    Operating System: <unknown>
    CPUs: 4
    Total Memory: 19.22 GiB
    Name: vps46.timecash.cn
    ID: LGNH:GIPP:LUP5:YYDC:VKVC:PPUW:MMGR:JA4V:VFV4:7L7L:E23U:PULA
    bash-4.3 lib#
    bash-4.3 lib#
    bash-4.3 lib#
    
  • 相关阅读:
    API创建员工联系人
    API创建员工Element
    API创建员工
    API创建员工支付方式
    用API创建用户
    用API给用户添加职责
    创建银行API
    创建银行分行的API
    初探C++ 深拷贝与浅拷贝
    推断数据是否为整数
  • 原文地址:https://www.cnblogs.com/migongci0412/p/5966419.html
Copyright © 2020-2023  润新知