To show only running containers use the given command:
(要仅显示正在运行的容器,请使用给定命令:)
docker ps
To show all containers use the given command:
(要显示所有容器,请使用给定命令:)
docker ps -a
To show the latest created container (includes all states) use the given command:
(要显示最新创建的容器 (包括所有状态),请使用给定命令:)
docker ps -l
To show n last created containers (includes all states) use the given command:
(要显示n个最后创建的容器 (包括所有状态),请使用给定命令:)
docker ps -n=-1
To display total file sizes use the given command:
(要显示总文件大小,请使用给定命令:)
docker ps -s
The content presented above is from docker.com .
(上面显示的内容来自docker.com 。)
In the new version of Docker, commands are updated, and some management commands are added:
(在新版本的Docker中,命令已更新,并添加了一些管理命令:)
docker container ls
It is used to list all the running containers.
(它用于列出所有正在运行的容器。)
docker container ls -a
And then, if you want to clean them all,
(然后,如果您要清洁它们,)
docker rm $(docker ps -aq)
It is used to list all the containers created irrespective of its state.
(它用于列出所有创建的容器,无论其状态如何。)
And to stop all the Docker containers (force)
(并停止所有Docker容器(强制执行))
docker rm -f $(docker ps -a -q)
Here the container is the management command.
(这里的容器是管理命令。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…