Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

BKM: Change Docker Data Location

xwu2 edited this page Feb 4, 2020 · 11 revisions

The docker engine by default stores the data (images and containers) under the /var/lib/docker directory. Usually this is a space-limited root partition. Use the following steps to change the docker data directory:

  • Create new docker data directory under /home:
sudo mkdir /home/docker
sudo chown root.docker /home/docker
sudo chmod 700 /home/docker
  • Modify the docker configuration /etc/docker/daemon.json to point to the new directory:
{
    "graph": "/home/docker"
}
  • Restart docker:
sudo systemctl stop docker
sudo systemctl start docker
  • Remove the old data directory:
sudo rm -rf /var/lib/docker