Update README.md (#198)

Add a check to see if there are any containers to delete
This commit is contained in:
Mohamed Abdelhalim 2024-12-31 05:00:47 +02:00 committed by GitHub
parent 03caf4687b
commit 5b1b6d7738
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -745,13 +745,15 @@ docker run --rm ubuntu env
### Kill running containers ### Kill running containers
```sh ```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) ### Delete all containers (force!! running or stopped containers)
```sh ```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 ### Delete old containers