Created
September 30, 2022 09:41
-
-
Save jonwhittlestone/693ea178e9ef751ace352733fc145265 to your computer and use it in GitHub Desktop.
useful-bash-docker-remove-named.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count the docker containers where the image name is `contact-app-frontend` and the container name contains `ci_temp` | |
docker ps -a | awk '{ print $1,$2,$15 }' | grep contact-app-frontend | grep ci_temp | awk '{print $1 }' | awk '{print NR}' | tail -1 | |
# remove those containers | |
docker ps -a | awk '{ print $1,$2,$15 }' | grep contact-app-frontend | grep ci_temp | awk '{print $1 }' | xargs -I {} docker rm -f {} || true" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment