Linux下的Docker更改image儲存位置

官方方法

修改/etc/docker/daemon.json加入下面設定

1
2
3
{
"data-root": "/mnt/docker-data"
}

重新啟動docker service

1
2
sudo systemctl stop docker.service
sudo systemctl start docker.service

確認路徑已經修改

1
docker info | grep "Docker Root Dir"

https://docs.docker.com/config/daemon/#daemon-data-directory

步驟參考(Docker更新後原本設定的位置會被改回去,不推薦)

https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

Linux下的Docker更改image儲存位置

https://jenhaoyang.github.io/uncategorized/495b76571765/

Author

Steven

Posted on

2023-06-14

Updated on

2025-01-14

Licensed under

Comments