Default docker image location => /var/lib/docker
Want to move it to => /data/docker
$ sudo -i
$ systemctl stop docker
$ vi /lib/systemd/system/docker.service
Find this line:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Change it to:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /data/docker
$ sudo -i
$ mkdir -p /data/docker
$ rsync -aqxP /var/lib/docker/ /data/
$ systemctl daemon-reload
$ systemctl start docker
Check the change:
$ ps aux | grep -i docker | grep -v grep
root 32597 4.0 0.1 1082988 82332 ? Ssl 14:24 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /data/docker
No comments:
Post a Comment