How to move the Docker Root Directory

During the installation of a vFunction Server on a Linux VM, the script checks to make sure there is at least 5gb of free space in the default Docker root directory, /var/lib/docker/ for the vFunction Container images.

Take the following steps to move the default Docker root directory if the disk space on the VM exists in another location.

In this example /app/docker is used as the new default Docker root directory. Replace this directory with your actual location in the steps below.

  1. Run sudo systemctl stop docker
  2. Run sudo systemctl stop docker.socket
  3. Run sudo systemctl stop containerd
  4. Run mkdir -p /app/docker/
  5. Run sudo mv /var/lib/docker /app/docker/
  6. Run vi /etc/docker/daemon.json
  7. Add these lines to this file:
{
  "data-root": "/app/docker/docker"
}
  1. Run sudo systemctl start docker
  2. Run docker info -f '{{ .DockerRootDir}}' to confirm the new Docker root location