docker修改默认的Docker Root Dir路径/var/lib/docker

方法一

停止docker服务,systemctl stop docker
vi /etc/docker/daemon.json
增加选项 “graph”: “/home/docker”,
启动docker服务,systemctl start docker

示例:

{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ],
  "graph": "/data0/k8s/docker",
  "insecure-registries": ["10.26.10.41:5000"]
}

方法二

停止docker服务,systemctl stop docker
cd /var/lib/
mv docker/* /home/docker
rm -rf docker
ln -s /home/docker/ /var/lib/docker
启动docker服务,systemctl start docker

发表评论

您的电子邮箱地址不会被公开。