Clean Up Unused Docker Containers, Images, Network, Volumes and Build Cache

preview_player
Показать описание
Learn how to clean up or remove unused Docker containers, images, Networks, Volumes and build cache.

What is docker prune? Pruning is a term used in docker to remove or clean up unused containers, images, networks, volumes and cache. These are also called dangling container, dangling images, dangling networks and dangling volumes. These Docker objects are labelled as dangling when it is not tagged and is not referenced by any container

The docker prune command allows you to remove unused docker objects or any docker object that is nor rferenced by any container.

Commands Used In THis Video
1) Remove unused containers
sudo docker ps -a
sudo docker container ls
sudo docker container ls --all
sudo docker container prune

2) Remove unused images
sudo docker image ls
sudo docker image prune -f

3) Remove unused volumes
sudo docker volume ls
sudo docker volume prune -f

4) Remove unused networks
sudo docker network ls
sudo docker network prune

5) Remove unused of everything... clean house
Depending on the flags you use, you can perform the following clean up task.
a) sudo docker system prune
The above command will will remove the following items.
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
b) sudo docker system prune --volumes
The above command will will remove the following items.
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all dangling images
- all build cache
c) sudo docker system prune --volumes -all
The above command will will remove the following items.
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all images without at least one container associated to them
- all build cache

YOUTUBE

- What Docker objects need clean up
- Clean up Docker containers
- Cleaning Docker images
- Cleaning dangling images
- Cleaning all Docker images
- Cleaning Docker volumes
- Clean up Docker networks
- Clean up your system

#docker, #container, #images, #prune,
Рекомендации по теме
Комментарии
Автор

Thank you for being comprehensive. Such a simple thing but other videos did not cover deleting as comprehensive as this one.

khalidh
Автор

This video has been incredibly helpful in deleting data from my server and computer that I couldn't delete. THANKS!

boedemirkol
Автор

Your video is helpful. Thank you very much ❤️

vuonsachtrongpho
Автор

can you help me regarding the docker.raw image i used docker system prune -a it deletes the container but does'nt reduce the docker.raw file size . pls help

professorpablo
Автор

You can just use `docker system prune`

kriptonian
Автор

I just do→ docker compose down >docker system prune -a > EC2 instance restart > docker compose up > df -h > resource is decreased about 3GB. >App is running good.

eeyore
Автор

I have followed the video, removed some things. How do I remove all the unused config files they had made? I still see them

the-papaw