因为是在虚拟机中安装了centos只分配了10G的空间
当我安装了docker后
安装服务器如`jumpserve`,`gitlab`,`jenkins`后要不了多久占用了太多的空间
当然可以扩容但是有点麻烦
有没有办法修改docker的存储空间
我们可以通过`docker info`查看默认的存储空间
```
Client:
Debug Mode: false
Server:
Containers: 4
Running: 4
Paused: 0
Stopped: 0
Images: 6
Server Version: 19.03.15
Storage Driver: zfs
Zpool: myraid1
Zpool Health: ONLINE
Parent Dataset: myraid1
Space Used By Parent: 380262423552
Space Available: 102384526336
Parent Quota: no
Compression: off
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.18-10-pve
Operating System: Debian GNU/Linux 9 (stretch)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.55GiB
Name: pve
ID: CQY7:JPC7:E6UE:C452:2XYP:NWOA:WT46:AUZH:QTUS:5VXU:NYWD:6XK4
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
```
我们可以看到docker默认存储空间为`/var/lib/docker`
以下操作可以修改存储空间,前提是你的docker是刚安装,没有太多的镜像和容器
```
systemctl stop docker
rm -rf /var/lib/docker
ln -sv /media/www/docker /var/lib/docker
systemctl start docker
```