pruneTo use this command, both the client and daemon API versions must be at least 1.25. Use the docker version command on the client to check the client and daemon API versions. docker volume prune [OPTIONS] Delete local volumes not used by any container. OPTIONS
rmTo use this command, both the client and daemon API versions must be at least 1.21. Use the docker version command on the client to check the client and daemon API versions. docker volume rm [OPTIONS] VOLUME [VOLUME...] Deletes one or more volumes. Starting from version 1.25, an option --force, -f is supported to force the deletion of one or more volumes. Supplement: Docker removes, trims, and deletes (prunes) unused images, containers, volumes, and networks See docker prune Provides the prune command to remove unused images, containers, volumes, and networks. Prune imagesDocker image prune removes images that are not tagged and are not referenced by containers. These images are called dangling images. Example 1: docker image pruneDeleted redis, no tags and no references #docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES # docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest ae2feff98a0c 4 days ago 133MB redis <none> ef47f3b6dc11 8 days ago 104MB centos latest 300e315adb2f 12 days ago 209MB ubuntu latest f643c72bc252 3 weeks ago 72.9MB docs/docker.github.io latest 32ed84d97e30 6 months ago 1GB # docker image prune # docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest ae2feff98a0c 4 days ago 133MB centos latest 300e315adb2f 12 days ago 209MB ubuntu latest f643c72bc252 3 weeks ago 72.9MB docs/docker.github.io latest 32ed84d97e30 6 months ago 1GB Example 2: Remove all images that are not used by containers -adocker image prune -a Skip warning prompts: --force or -f docker image prune -f Example 3: Execute filter deletion:Images created more than 24 hours ago docker image prune -a --filter "until=24h" For more information about filters, see the docker image prune manual. Remove containersWhen the container is stopped, it is not automatically deleted unless --rm is specified during docker run. A stopped container’s writable layer will still take up disk space, so to clear it, use the docker container prune command.
Removing a VolumeVolumes are used by one or more containers and take up space on the host machine. The volume will not be removed automatically because doing so would destroy the data. docker volume prune
Remove a networkDocker networks do not take up disk space, but they create iptables rules, bridge network services, and routing entries. Clear the network not used by the container, do this docker network prune
Remove EverythingThe docker system prune command is a shortcut for removing images, containers, and networks. In Docker 17.06.0 and earlier, volumes can also be removed. In Docker 17.06.1 or later, you need to specify the --volumes parameter. Example (without removing the volume):# docker system prune WARNING! This will remove: - all stopped containers - All networks not used by at least one container - all dangling images -all build cache Are you sure you want to continue? [y/N] y Example (with the ability to remove volumes): Add --volumes# docker system prune --volumes WARNING! This will remove: - 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 Are you sure you want to continue? [y/N] y
The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Example code for implementing multiple line omissions using three methods of advanced CSS
>>: The popularity of Chinese domain names in China has ushered in a new round of climax
1. CSS background tag 1. Set the background color...
First of all, we need to make it clear why we use...
Table of contents Preface Problem: Large file cop...
Vertical Split Vertical splitting refers to the s...
This article shares the installation and configur...
Table of contents 1. Import files using script ta...
Table of contents Require Implementation Code dat...
There were always problems when installing tortoi...
Preface During the development process, you will ...
Table of contents 1. What is lazy loading of rout...
Why use Server-Side Rendering (SSR) Better SEO, s...
When installing Tomcat in Docker, Tomcat may over...
Written in front When we operate the database in ...
Table of contents 1. Ant Design Vue 1. Official w...
This article example shares the specific code of ...