• Docker 修改默认存储位置


    • 首先使用 docker info 查看 docker 的基本信息
    sudo docker info
    Containers: 0
    Images: 5
    Storage Driver: devicemapper
     Pool Name: docker-253:0-679369-pool
     Pool Blocksize: 65.54 kB
     Backing Filesystem: extfs
     Data file: 
     Metadata file: 
     Data Space Used: 533.9 MB
     Data Space Total: 107.4 GB
     Data Space Available: 106.8 GB
     Metadata Space Used: 954.4 kB
     Metadata Space Total: 2.147 GB
     Metadata Space Available: 2.147 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Library Version: 1.02.89-RHEL6 (2014-09-01)
    Execution Driver: native-0.2
    Logging Driver: json-file
    Kernel Version: 2.6.32-431.29.2.el6.x86_64
    Operating System: <unknown>
    CPUs: 1
    Total Memory: 853.5 MiB
    Name: rhel62build
    ID: LIO4:I43U:YFQU:SN45:YOE6:7GTF:6AGX:VSKQ:ICIV:AKWD:3OKQ:HUSC
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    这是一个新装的docker环境,其中看不出当前docker文件存储的路径。但是docker默认会使用 /var/lib/docker 作为默认存储位置。

    • 停止 Docker 服务
    sudo /etc/init.d/docker stop
    • 1
    • 将原来默认的/var/lib/docker备份一下,然后复制到别的位置并建立一个软链接
    cd /var/lib
    sudo cp -rf docker docker.bak
    sudo cp -rf docker /<my_new_location>/
    sudo ln -s /<my_new_location>/docker docker
    • 1
    • 2
    • 3
    • 4
    • 启动 Docker 服务
    sudo /etc/init.d/docker start
    • 1
    • 最后使用 docker info 查看更新结果
    sudo docker info
    Containers: 0
    Images: 5
    Storage Driver: devicemapper
     Pool Name: docker-8:21-393695-pool
     Pool Blocksize: 65.54 kB
     Backing Filesystem: extfs
     Data file: /dev/loop1
     Metadata file: /dev/loop2
     Data Space Used: 533.9 MB
     Data Space Total: 107.4 GB
     Data Space Available: 15.33 GB
     Metadata Space Used: 954.4 kB
     Metadata Space Total: 2.147 GB
     Metadata Space Available: 2.147 GB
     Udev Sync Supported: true
     Deferred Removal Enabled: false
     Data loop file: /build/docker/devicemapper/devicemapper/data
     Metadata loop file: /build/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-431.29.2.el6.x86_64
    Operating System: <unknown>
    CPUs: 1
    Total Memory: 853.5 MiB
    Name: rhel62build
    ID: LIO4:I43U:YFQU:SN45:YOE6:7GTF:6AGX:VSKQ:ICIV:AKWD:3OKQ:HUSC
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    转载请以链接形式标明本文地址 
    本文地址:http://blog.csdn.net/kongxx/article/details/50310653

     
     
     

     

  • 相关阅读:
    Java线程安全和非线程安全
    时间戳获取(周,年,月,日)
    spring+spring 日志输出
    Spring+springMvc+Mybatis
    关于mysql处理百万级以上的数据时如何提高其查询速度的方法
    Tomcat 详解
    理解 $_POST、$_GET 、php://input
    php编译参数注解--不明白许多参数的作用 慎用 –with-curlwrappers参数【转载】
    centos6.5编译安装php[整理一]
    ubuntu16.04 安装chrome 和 phpstorm
  • 原文地址:https://www.cnblogs.com/shiningrise/p/5730607.html
Copyright © 2020-2023  润新知