1.编辑/etc/docker/daemon.json

{
    "data-root": "/data/docker"
}

2.重启docker

systemctl restart docker

 

1.编辑/etc/sysconfig/docker

OPTIONS中 --selinux-enabled=false后添加 --graph=/data/docker

2.重启docker

systemctl restart docker

 

1.编辑/usr/lib/systemd/system/docker.service

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --data-root=/data/docker
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2

2. 重启docker

systemctl daemon-reload

systemctl restart docker

 

1.建立软连接

mv /var/lib/docker /data/docker
ln -s /data/docker /var/lib/docker

2.重启docker

systemctl restart docker

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注