挂载目录
1.挂载硬盘
fdisk /dev/sdb
2.格式化硬盘
mkfs.ext4 /dev/sdb1
echo "/dev/sdb1 /data ext4 defaults 0 0" >> /etc/fstab
指定目录
1.查看默认目录
sudo docker info | grep "Docker Root Dir"
2.停止docker服务
systemctl stop docker
3.docker的配置文件路径在/etc/docker/daemon.json,增加一个key和value,指定docker的路径:"graph": "/new-path/docker"。
默认采用的"storage-driver"是overlay2,如果使用xfs系统需要格式化的时候指定打开ftype,命令:mkfs.xfs -n ftype=1 /path/to/your/device
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://dockerhub.azk8s.cn"],
"graph": "/data/lib/docker"
}
mkdir -p /data/lib/docker
4.启动docker服务
systemctl start docker
执行docker info,查看docker信息如下:
[[email protected] ~]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.688GiB
Name: localhost.localdomain
ID: IWSE:VMJM:POT7:VGAI:6ZZM:MJQZ:MD44:UB44:BOSJ:2D7U:HQAO:JVOZ
Docker Root Dir: /data/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://dockerhub.azk8s.cn/
Live Restore Enabled: false
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
原文地址:https://www.cnblogs.com/beilong/p/12247135.html