Stop all containers
docker stop $(docker ps -a -q)
Delete images
- By image name
docker rmi $(docker images 'imagename' -a -q)
- Untagged images
docker rmi $(docker images -f "dangling=true" -q)
Export/import image as .tar file
- Save image to .tar file
docker save -o <filename>.tar <image-name>:<image-tag>
- Load/import image
docker load -i <filename>.tar
Move the Docker directory
We gonna move the default docker directory "/var/lib/docker" to another.
Usually doing it when the docker host disk was not propertly dimensioned and we cannot increase de size.
Stop the docker service
service docker stop
Verify if docker process is running yet
ps faux | grep docker --color
Verify there is some files in the default docker directory
ls -la /var/lib/docker/
Make a backup from docker directory
tar -zcC /var/lib docker > /dados/docker/bkp/var_lib_docker-backup-$(date +%s).tar.gz
Move the directory /var/lib/docker to new home
mv /var/lib/docker /dados/docker
Create a symlink
ln -s /dados/docker /var/lib/docker
Verify symlink working well
ls -la /var/lib/docker
Start the docker service
service docker start
Top comments (0)