systemctl disable docker

#可以看到docker.service是在那里

systemctl stop docker

#基于上面执行的systemctl disable docker 查看docker.service在哪里,然后进行编辑

cp /usr/lib/systemd/system/docker.service /usr/lib/systemd/system/docker.service.bak

mkdir -p /data/docker

vi  /usr/lib/systemd/system/docker.service

#将

ExecStart=/usr/bin/dockerd   $DOCKER_NETWORK_OPTIONS

#添加如下内容:

ExecStart=/usr/bin/dockerd --graph=/data/docker $DOCKER_NETWORK_OPTIONS

然后重新启动docker

systemctl daemon-reload

systemctl enable docker

systemctl restart docker

#查看验证目录是否配置正确

docker info |grep Dir

#若docker与k8s进行结合时,启动docker的时候,出现

Failed to get properties: Connection timed out

解决方法:重启主机即可