版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
1. 操作步骤
- 查看Docker配置信息
- 修改配置文件
- 重启查看是否修改成功
1.1 查看Docker配置信息
查看Docker Root Dir 参数,容器默认存储在 /var/lib/docker 位置
[root@xxxxx]# docker info
Client:
Debug Mode: false
Server:
Containers: 68
Running: 40
Paused: 0
Stopped: 28
Images: 101
Server Version: 19.03.2-beta1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-693.2.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 47.01GiB
Name: rcitech-fabric-sandbox
ID: INUQ:ZFOX:RMK3:FQRP:O5PV:ZFZV:P4IL:FCBK:L7RM:SDEK:MPJF:QWFY
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
1.2 修改配置文件
打开 /etc/docker/daemon.json 输入以下内容(如果没有找到就创建一个)
{
"graph":"/data/docker"
}
1.3 重启查看是否修改成功
[root@localhost ~]# systemctl restart docker
[root@localhost ~]# docker info
查看 Docker Root Dir 参数 是否有变化。