查看运行容器
docker ps
查看所有容器docker ps -a
进入容器其中字符串为容器ID:docker exec -it d27bd3008ad9 /bin/bash
1.停用全部运行中的容器:docker stop $(docker ps -q)
2.删除全部容器:docker rm $(docker ps -aq)
3.一条命令实现停用并删除容器:docker stop $(docker ps -q) & docker rm $(docker ps -aq)
实际示例:
[root@master01 ~]# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 17G 17G 646M 97% /[root@master01 ~]# docker rm $(docker ps -aq)af67891901bcb0e62188855305e4b231323ae0beb603c0add404530b8586469a598cd053f9b90a4d1cf997b572b15533eac109e7023bb513cd1b702c[root@master01 ~]# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 17G 15G 2.7G 85% /