by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

Sometimes I tried a bunch of containers or images in my own environment, how to remove all the images and containers in the system?
These instructions are provided for your reference:

Note that you do understand what containers and images are in docker.
Do not execute the following commands at will, on the online host:

stop all containers: stop all containers
docker kill $(docker ps -q)

remove all containers: Remove all containers
docker rm $(docker ps -qa)

remove all docker images: remove all docker images
docker rmi $(docker images -q)


Note: Regarding the difference between docker stop and docker kill, we can view the instructions through the following commands:
docker help stop
The main process inside the container will receive SIGTERM , and after a grace period, SIGKILL .

docker help kill
The main process inside the container will be sent SIGKILL , or any signal specified with option --signal .

Tags: docker

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker

Wenchat about the evolution history of my network

Hear about the evolution of my network. My GCP costs $46.35 per month, and the current free trial balance is $111.05, I've almost spent $300, and I'm about to move back to a self-managed host.

certbot,docker,ftp

curlftpfs introduction and manual certificate application

Situation sharing, imagine that you have WebHosting, which only provides FTP connection, and then you want to apply for a certificate manually. In this article, I share how I use Docker to install curlftpfs, mount the FTP folder of the remote host, and then execute certbot in the container to apply for an SSL certificate. Leaving aside the certificate application, when I first discovered the curlftpfs command, I found it very interesting, especially if you are a MacOS user and do not have a satisfactory FTP software at hand. You love scrolling through the command line as much as I do, so maybe you should love this command too. 🤭

docker

How to simply use Docker to create an internet command line speed test program?

How to simply use Docker to create an internet command line speed test program? Here we use the python program speedtest-cli Will use Docker for the main use case, for example, I want to test the speed in my NAS, Although there is python in my NAS, but there is no pip command, it feels much safer to use Docker at this time. Of course, your NAS needs to be able to run Docker :). Or, I am in a MacOS environment, and I don't want to install speedtest-cli into my MacOS. At this time, it is not bad to use Docker to build a simple execution environment by yourself.