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:
- When installing software in Ubuntu, it prompts: E: You don’t have enough free space in /var/cache/apt/archives/.
- [Solved] docker Startup Error: Job for docker.service failed because the control process exited with error code
- [Solved] Job for docker.service failed because the control process exited with error code. After changing the docker configuration
- [Solved] Docker Download Mirror Error: Cannot connect to the Docker daemon at…
- Linux Install Docker Error: Failed to restart docker.service: Unit docker.service not found.
- [Solved] Docker Staratup Error: Failed to start Docker Application Container Engineadsafdsad.
- Ubuntu sub process/usr/bin/dpkg returned an error code (1) solution
- Docker pull Command Error response from daemon: Head https://registry-1.docker.io/v2/library/
- The resolution of Ubuntu 16.04 screen can’t be modified and the solution of circulating login
- [Solved] Raspberry Pi Error: You don’t have enough free space in /var/cache/apt/archives/
- [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
- [Solved] Docker error: “unknown runtime specified NVIDIA” using GPU“
- Ubuntu20.04 install the ROS noetic version in catkin_Problems in make compilation
- The upgrade of Ubuntu results in an error in the compilation of Android Jack [Two Method to Solve]
- Docker Error: error invoking remote method ‘docker-start-container‘: error: (http code 500) server error –
- How to Solve Xmind Install Error in Ubuntu System
- How to Solve labelme Install Error in Ubuntu
- [Solved] Any Softwares Install Error in Ubuntu: /usr/bin/dpkg returned an error code
- Error: ENOSPC: no space left on device [How to Solve]
- Docker Start Container Error: Error response from daemon: task already exists: unknown