I want docker to stop using my root partition for storing docker containers, and use a different partition instead, e.g. /home
These steps worked for me:
- Stop all containers
sudo docker stop $(docker ps -a -q)
- Stop docker
sudo service docker stop
- Copy docker directory
cp -r /var/lib/docker/* /home/docker/
- Unmount all old docker overlays
umount -f /var/lib/docker/overlay/
andumount -f /var/lib/docker/containers/*/mounts/shm
- Add or update
/etc/docker/daemon.json
with
{
"graph": "/home/docker/"
}
- Start docker with
sudo service docker start
- Remove old
/var/lib/docker/
update:
graph
is outdated, usedata-root
and then
references