docker container image files and other related directory migration

Migration purposes:

The default installed in the system tray, usually around the cloud server system disk is 40G container was filled, this time must be done migrated

 

First, clean up the image of a recorded command

# Following commands to clear unwanted image 
Docker Image Prune -a - f 

# container due to the rollback of demand, only manually delete! !

 

Personally verify the feasibility of the following methods

docker default storage directory is / var / lib / docker, the following operations with systemctl, no service, with the service because if there was a place will not take effect

systemctl stop docker

 

Create a directory on a large disk space

mkdir -p /home/cjh

 

Migrate all the files to the new directory (Note that the last copy will produce docker directory, so the following configuration path is / home / cjh / docker)

cp /var/lib/docker /home/cjh

 

Configuration File

mkdir -p /etc/systemd/system/docker.service.d/
 vi /etc/systemd/system/docker.service.d/devicemapper.conf

 

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph=/home/cjh/docker

 

Reload configuration and service

systemctl daemon-reload

systemctl restart docker

systemctl enable docker

 

Normal service starts, but the start of the container when the newspaper made a mistake: "docker-runc not installed on system"

Solution: 
cd / usr / libexec / Docker /
 LN -s-runc-Current Docker Docker-runc

 

Attach reference blog: https: //www.cnblogs.com/insist-forever/p/11739207.html

 Reproduced, please indicate the source blog: http://www.cnblogs.com/cjh-notes/

Guess you like

Origin www.cnblogs.com/cjh-notes/p/12197968.html