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

How to use multiple YAML files to execute multiple docker container services

This video introduces how to use the docker-compose command to specify multiple YAML structure language configuration files to create container execution, and introduces how we simplify docker-compose by using .env in the D-Laravel environment Start command.

docker,laravel

It's super easy to build a Lravel development environment with Docker

Are you ready for the Laravel 5.5 system environment? laravel/framework 5.5.x-dev requires php >=7.0 -> your PHP version (5.6.30) does not satisfy that requirement. This article describes how to create a Laravel development environment using Docker. With the simple to explosive D-Laravel simple bash, Don't say that I can't set up a Laravel development environment.

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.