I update my kernel of Debian from 3.x to 4.x.
Docker storage become overlay2.
ls /var/lib/docker/
containers image network overlay2 plugins swarm tmp trust volumes
old directory structure is
aufs containers graph image init linkgraph.db network plugins repositories-aufs swarm tmp tmp-old trust volumes
My images is in aufs directory, I can not start docker service with old directory. how can I move my images to overlay2?
After downloading a five-layer image using docker pull ubuntu , you can see six directories under /var/lib/docker/overlay2 .
overlay2. overlay2 is the preferred storage driver for all currently supported Linux distributions, and requires no extra configuration. fuse-overlayfs. fuse-overlayfs is preferred only for running Rootless Docker on a host that does not provide support for rootless overlay2 .
Identify the images to save and restore after migrating from aufs to overlayfs2.
Export all the images to be migrated to overlayfs into one archive - this is faster and efficient
sudo docker save $IMAGES -o /data/save.tar
Here IMAGES
is a variable containing the image names
Create /etc/docker/daemon.json with following contents:
{
"storage-driver": "overlay2"
}
[ Refer to https://stackoverflow.com/questions/42245288/add-new-element-to-existing-json-array-with-jq/57537190#57537190 for updating it using jq ]
Take the backup of the directory where docker images are stored and delete the directory
mv /var/lib/docker/images /var/lib/docker.aufs.images
systemctl daemon-reload
systemctl restart docker
docker load < save.tar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With