官术网_书友最值得收藏!

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
主站蜘蛛池模板: 长岭县| 万载县| 随州市| 尚义县| 涞源县| 慈利县| 山丹县| 淳安县| 望江县| 黔西县| 安新县| 承德市| 新民市| 阿拉善盟| 福贡县| 长寿区| 潮州市| 烟台市| 安国市| 平昌县| 盖州市| 新龙县| 襄汾县| 凤凰县| 盐源县| 阿合奇县| 景洪市| 木兰县| 康保县| 武清区| 烟台市| 新疆| 吴旗县| 宜君县| 察雅县| 乡城县| 夏津县| 界首市| 玉屏| 游戏| 合肥市|