Skip to content

Instantly share code, notes, and snippets.

@johnelliott
Last active March 19, 2019 14:00
Show Gist options
  • Select an option

  • Save johnelliott/60b44e0cafb247abf59e to your computer and use it in GitHub Desktop.

Select an option

Save johnelliott/60b44e0cafb247abf59e to your computer and use it in GitHub Desktop.
Remove Docker contrainers with grep
Example: want to remove all things with ubuntu 14.04..
remove docker contrainers with grep:
```~/dev/practice/docker
$ docker ps -a |grep 14.04|cut -d" " -f 1|xargs -n 3 docker rm
ffefde7fe6ac
74f390d831e4
3c9750561f25
e34ab210baff
114af06a2e33
0d3495054900
0c4967b76dd5
00d8019f91c0
```
or use awk... https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes
docker images -a | grep "pattern" | awk '{print $3}' | xargs docker rmi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment