Skip to content

Useful docker commands

Filipe Pereira edited this page Oct 12, 2017 · 1 revision

Remove all volumes not explicitly named on docker-compose

docker volume ls | tr -s ' ' | cut -d ' ' -f 2 | grep '.\{64\}' | xargs docker volume rm

Remove all volumes excluding a pattern (Ex. ending in '_data')

docker volume ls | tr -s ' ' | cut -d ' ' -f 2 | grep -v '_data$

Remove all volumes including a pattern (Ex. ending in '_data')

docker volume ls | tr -s ' ' | cut -d ' ' -f 2 | grep '_data$

Clone this wiki locally