Last Updated on November 16, 2024 by sandeeppote
Docker uses storage drivers to store the read-only images and writable containers
It basically has 6 layers
Read-only/Image Layers
- Base Image e.g. Ubuntu OS
- Packages/Repositories e.g. apt etc
- Dependencies e.g. pip etc
- Custom Code e.g. python code etc
- Enrtypoint or command i.e. excutes the program
Writable Layer
6. Container Layer
Data and files related to images and containers are store in /var/lib/docker folder in Ubuntu
To check the storage driver used by the docker, use following command-
docker info | more
Im my case it is overlay2
You can also use this command to get the storage driver
docker info | grep "Storage Driver"
How to change the storage driver
Stop the Docker service
systemctl stop docker.socket
systemctl stop docker
Check the docker service status
service docker status
Backup the docker folder
cp -au /var/lib/dovker /var/lib/docker.bk
Change the storage driver
echo '{ "storage-driver": "aufs" }' | sudo tee /etc/docker/dameon.json
service docker start
Image credit and reference links –
https://docs.docker.com/storage/storagedriver/
https://docs.docker.com/storage/storagedriver/overlayfs-driver/