Skip to content

Instantly share code, notes, and snippets.

@vigack
Created January 3, 2018 05:00
Show Gist options
  • Save vigack/6c5ec8e7ec24072b0d1574812177ebf3 to your computer and use it in GitHub Desktop.
Save vigack/6c5ec8e7ec24072b0d1574812177ebf3 to your computer and use it in GitHub Desktop.
一行代码关闭所有运行中的docker容器
docker ps|awk '{if (NR!=1) print $1}'| xargs docker stop
@vigack
Copy link
Author

vigack commented Jan 3, 2018

主要运用了awk和xargs,同样的原理可用于删除容器、镜像等

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment