Skip to content

Instantly share code, notes, and snippets.

@tomoh1r
Last active January 1, 2016 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoh1r/8077864 to your computer and use it in GitHub Desktop.
Save tomoh1r/8077864 to your computer and use it in GitHub Desktop.
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