- Learn OpenShift
- Denis Zuev Artemii Kropachev Aleksey Usov
- 125字
- 2021-08-13 16:03:47
Removing containers
In order to delete a container, you can use the docker rm command. If the container you want to delete is running, you can stop and delete it or use the -f option and it will do the job:
$ docker rm 3b1150b50343
Error response from daemon: You cannot remove a running container 3b1150b5034329cd9e70f90ee21531b8b1ab1d4a85141fd3a362cd40db80e193. Stop the container before attempting removal or force remove
Let's try using -f option.
$ docker rm -f 3b1150b50343
Another trick you can use to delete all containers, both stopped and running, is the following command:
$ docker rm -f $(docker ps -qa)
830a42f2e727
00f343906df3
5e3820a43ffc
419e7ce2567e
Verify that all the containers are deleted:
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
推薦閱讀
- Mastering ElasticSearch
- Windows Server 2019 Cookbook
- Modern Web Testing with TestCafe
- 從零開始寫Linux內核:一書學透核心原理與實現
- Learning Windows Server Containers
- 鴻蒙生態:開啟萬物互聯的智慧新時代
- 異質結原理與器件
- Windows Vista融會貫通
- Instant Optimizing Embedded Systems using Busybox
- Linux服務器配置與管理
- VMware Horizon View Essentials
- Linux系統最佳實踐工具:命令行技術
- Troubleshooting Docker
- Azure Resource Manager Templates Quick Start Guide
- 基于Arduino的嵌入式系統入門與實踐