Install docker and change data directory

Docker is a useful container but by default all docker’s stuff will place in /var/lib/docker in many case this will share with root disk space. For easy to maintain disk space we just change docker’s directory to separate disk or path.

Install docker

wget -O- | bash -

Edit /etc/docker/daemon.json


Stop dockerd

service docker stop

Move old docker data

rsync -aP /var/lib/docker/* /path/to/target/

Start dockerd

service docker start



Leave a Reply

%d bloggers like this: