mirror of
https://github.com/wsargent/docker-cheat-sheet.git
synced 2025-09-21 21:30:48 +02:00
Update README.md (#198)
Add a check to see if there are any containers to delete
This commit is contained in:
parent
03caf4687b
commit
5b1b6d7738
1 changed files with 4 additions and 2 deletions
|
@ -745,13 +745,15 @@ docker run --rm ubuntu env
|
|||
### Kill running containers
|
||||
|
||||
```sh
|
||||
docker kill $(docker ps -q)
|
||||
if [ "$(docker ps -q)" ]; then docker kill $(docker ps -q); else echo "No running containers."; fi
|
||||
|
||||
```
|
||||
|
||||
### Delete all containers (force!! running or stopped containers)
|
||||
|
||||
```sh
|
||||
docker rm -f $(docker ps -qa)
|
||||
if [ "$(docker ps -qa)" ]; then docker rm -f $(docker ps -qa); else echo "No containers to delete."; fi
|
||||
|
||||
```
|
||||
|
||||
### Delete old containers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue