First, check the docker location:
docker info
Stop docker service
systemctl stop docker
Look at the high capacity location and create a transfer directory on it
df -h
mkdir -p /home/docker
Take/home/docker as an example. I will transfer the docker of/var/lib/docker to here later.
Migrate the files in/var/lib/docker directory to the target location
sudo rsync -avz /var/lib/docker /home/docker
Create a new/etc/docker/daemon.json file and edit it
There is no such file by default, so you can create and edit it directly with vim
sudo vim /etc/docker/daemon.json
Here is how to use vim.
Press i to enter the insert state and copy the following list into the file
{
"graph":"/docker/lib/docker"
}
Press Esc to exit the insert state, then press shift+:
and then press wq! Enter to force save the file.
PS. If you encounter any swap file already open when inserting, then sudo rm file name to delete the file
Reload docker and restart docker
systemctl daemon-reload && systemctl restart docker
Check whether the docker is changed to a new directory
docker info
Delete old docker directory
rm -rf /var/lib/docker
Read More:
- [Solved] Docker error: “unknown runtime specified NVIDIA” using GPU“
- Docker Start Container Error: Error response from daemon: task already exists: unknown
- [Solved] Job for docker.service failed because the control process exited with error code. After changing the docker configuration
- See system logs and ‘systemctl status docker.service‘ for details
- [Solved] docker: Error response from daemon: OCI runtime create failed: container_linux.go:380
- Linux Install Docker Error: Failed to restart docker.service: Unit docker.service not found.
- [Solved] Win 10 VS Code Connect to the container of the server error: Cannot connect to the Docker daemon at … Is the docker daemon running
- How to Solve Docker delete container image error: Error response from daemon: conflict: unable to delete 7cc1942f1ed5 (must be forced)
- [Solved] kubeadm join Cluster Error: error execution phase kubelet-start
- [Solved] Docker Staratup Error: Failed to start Docker Application Container Engineadsafdsad.
- Ubuntu sub process/usr/bin/dpkg returned an error code (1) solution
- Linux Connect Error: network.service failed [How to Solve]
- Docker -v Directory Mount (How to Use)
- [Solved] ubuntu Boot Error: /dev/nume0n1p2:clean
- The solution to the crash loop back off error of coredns in k8s deployment
- System has not been booted with systemd as init system (PID 1). Can‘t operate
- [Solved] Centos Mount Error: XFS: log mount mount/recovery failed : error -117
- Job for network.service failed [How to Solve]
- How to Fix Linux sub process /usr/bin/dpkg returned an error code (1)
- [Solved] ERROR: Linux route delete command failed: external program exited with error status: 2