Created
April 27, 2023 02:25
-
-
Save akkuman/6ed770535121f4fc2316d2ddccd3b60a to your computer and use it in GitHub Desktop.
停止所有匹配规则的指定docker compose stack
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
compose_names=`docker compose ls | awk '(NR>1) && (/^[a-f0-9]{32}\s+/) {print($1)}'` | |
for name in ${compose_names[@]}; do | |
cids=`docker ps --filter "label=com.docker.compose.project=${name}" --format '{{.ID}}'` | |
for cid in ${cids[@]}; do | |
docker rm -f -v "$cid" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment