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
If your computer is a Mac, using homebrew to inst...
Even though it's not Halloween, it's wort...
I'm currently learning about front-end perform...
MTR stands for Mini-Transaction. As the name sugg...
Table of contents Project Background start Create...
Table of contents 1. Brief Overview 2. JSON basic...
The powerful tool cgroup in the kernel can not on...
Table of contents 1. Pre-analysis 1. Variable pre...
Preface It's a cliché. Here I will talk about...
MySQL software installation and database basics a...
Table of contents Rendering Install Code Implemen...
1. The Linux server configures /etc/hosts.deny to...
Assume there is such an initial code: <!DOCTYP...
This article introduces blue-green deployment and...
Table of contents Preface 1. Object.freeze() 2. O...