Open junxnone opened 4 years ago
docker image
1 Stop docker service
sudo systemctl stop docker
2 rsync your /var/lib/docker to your new path
/var/lib/docker
your new path
rsync -avz /var/lib/docker /your_path/docker
3 Set docker config data-root - /your_path/docker
data-root
/your_path/docker
vi /etc/docker/daemon.json
{
"data-root": "/your_path/docker", }
> 如果本身有其他配置,记得加 `,`
4 Start docker service
sudo systemctl daemon-reload sudo systemctl start docker
5 restart your container
默认会重启自启动的 container docker info | grep 'Docker Root' Docker Root Dir: /your_path/docker
默认会重启自启动的 container
container
docker info | grep 'Docker Root'
Docker Root Dir: /your_path/docker
junxnone/linuxwiki#39
移动数据到新位置
Reference
Brief
docker image
存储位置Steps
1 Stop docker service
2 rsync your
/var/lib/docker
toyour new path
3 Set docker config
data-root
-/your_path/docker
"data-root": "/your_path/docker", }
4 Start docker service
5 restart your container