下述过程都是在cenots 7.2上进行。
默认安装完成docker后 docker 的所有images及相关信息存储位置为:/var/lib/docker而通常我们系统盘挂载盘一般不会很大,所以需要将其移到其他分区,我们可以采用软连接的方式来完成,示例,下面我们将其移到/home/dockerfile 目录下,具体方法如下:
首先暂停docker 服务
[root@localhost docker]# service docker stop
将文件移到指定目录:
[root@localhost docker]# cd /var/lib/
[root@localhost lib]# mv docker/* /home/dockerfile
[root@localhost dockerfile]# ln -s /home/dockerfile/ /var/lib/docker
查看一下,当前/var/lib/docker
[root@localhost lib]# ls -la docker lrwxrwxrwx. 1 root root 17 Mar 7 21:28 docker -> /home/dockerfile/
OK,启动服务
[root@localhost lib]# service docker start
输入命令查看是否成功
[root@localhost lib]# docker info
[root@localhost lib]# docker info Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 7 Server Version: 1.10.2 Storage Driver: devicemapper Pool Name: docker-253:2-4563448077-pool Pool Blocksize: 65.54 kB Base Device Size: 10.74 GB Backing Filesystem: xfs Data file: /dev/loop0 Metadata file: /dev/loop1 Data Space Used: 1.265 GB Data Space Total: 107.4 GB Data Space Available: 106.1 GB Metadata Space Used: 2.605 MB Metadata Space Total: 2.147 GB Metadata Space Available: 2.145 GB Udev Sync Supported: true Deferred Removal Enabled: false Deferred Deletion Enabled: false Deferred Deleted Device Count: 0 Data loop file: /home/dockerfile/devicemapper/devicemapper/data WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning. Metadata loop file: /home/dockerfile/devicemapper/devicemapper/metadata Library Version: 1.02.107-RHEL7 (2015-12-01) Execution Driver: native-0.2 Logging Driver: json-file Plugins: Volume: local Network: null host bridge Kernel Version: 3.10.0-327.4.4.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 15.35 GiB Name: localhost.localdomain ID: UQP2:Z5KF:4DGT:3JRA:QUJU:V554:VUZD:PH2K:AD4C:57X3:TLA4:M6VH WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled [root@localhost lib]#