https://www.jianshu.com/p/f43a834aae80
cat /etc/systemd/system/multi-user.target.wants/docker.service
ExecStart=/usr/bin/dockerd-current \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
--init-path=/usr/libexec/docker/docker-init-current \
--seccomp-profile=/etc/docker/seccomp.json \
--graph /home/elasticsearch/docker \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
$REGISTRIES
通过docker info命令可以看到docker默认的存储目录是:
Docker Root Dir: /var/lib/docker
修改:
cd /etc/systemd/system/multi-user.target.wants
或者cd /usr/lib/systemd/system
总之通过locate找到docker.service在哪里就去哪里vim docker.service ExecStart=/usr/bin/dockerd
--graph=/data/docker_containers
--storage-driver=overlay
--registry-mirror=https://jxus37ad.mirror.aliyuncs.com
--graph=/data/docker_containers
docker新的存储位置 --storage-driver=overlay 当前docker所使用的存储驱动 注:存储驱动貌似不改也会变成overlay
重启:
systemctl daemon-reload systemctl restart docker
查看新变化:
docker info
Docker Root Dir: /data/docker_containers