Skip to content

Instantly share code, notes, and snippets.

@tomoh1r
Last active Jan 1, 2016
Embed
What would you like to do?
docker の稼働中の container 全て落とす関数
docker_killall() {
# 処理が進んでいる container の id を取得
_get_ids() { docker ps | awk 'NR != 1 { print $1 }' ; }
# 処理中の conatainer の数を取得
_ps_count=$(_get_ids | wc -l)
# 処理中の container が有れば、全て落とす
if [[ $_ps_count != 0 ]] ; then
_get_ids | xargs docker kill
else
echo 'docker container is not running.'
fi
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment