深度阅读

How to remove all Docker containers on Linux

作者
作者
2023年08月22日
更新时间
8.71 分钟
阅读时间
0
阅读量

Docker Containers can be used to run some applications in a lightweight way. we examine how to remove all containers.

List All Docker Containers

Before removing all containers we can list all containers.

$ docker ps -aq

How to Stop All Running Containers

Before removing all containers, we must stop all running containers in order to properly remove them. The docker stop command stops all containers.

$ docker stop $(docker ps -aq)

How to Remove All Containers

The docker rm command is used. All containers are specified with the $docker ps -aq command and provided to the “docker rm” command.

$ docker rm $(docker ps -aq)

With the following command, all images of the ship can be removed.

$ docker rmi $(docker images -q)

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。