How to move the Docker Root Directory
Overview
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.
Steps to change the Docker Root Directory
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.
- Stop the Docker service
sudo systemctl stop docker
- Stop the Docker Socket
sudo systemctl stop docker.socket
- Stop the Containerd service
sudo systemctl stop containerd
- If required, create the directory structure for Docker
mkdir -p /app/docker/
- Move the default Docker Root Directory to the new location
sudo mv /var/lib/docker /app/docker/
- Modify the Docker Daemon JSON
vi /etc/docker/daemon.json
### Add these lines to this file (or point to the alternate, new path used)
{
"data-root": "/app/docker/docker"
}
- Start the Docker service
sudo systemctl start docker
- Confirm that the new Docker Root Directory was applied
docker info -f '{{ .DockerRootDir}}'