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,git

Use docker-compose to quickly build a private git service

How to quickly set up an out-of-the-box Gogs environment? This article introduces the use of docker-compose.yml to quickly establish a gogs environment.

docker

About how to change the owner of FPM image on GCE

The CCC website has been upgraded to php 7.2.0. With a Docker environment, it is easy to upgrade php. There are still some precautions you should know about the change of Image on Linux. If you install D-Laravel on a Linux system through docker like me, when you change a different image, Perhaps you may encounter, doubt! Why composer does not have permission to write to the folder error. directory is not writable

docker

Install Docker and docker-compose with Raspberry Pi

This article briefly introduces how we install docker and docker-compose on Raspberry Pi.