# HG changeset patch # User Dirk Olmes # Date 1530759494 -7200 # Node ID fe986adeadeb46459b6a54e77e6e1037538a2ab1 # Parent abc3d303adde8d1aef3651ee637aa6517f03b300 add more helper functions diff -r abc3d303adde -r fe986adeadeb zshrc-docker --- a/zshrc-docker Wed Jul 04 17:04:39 2018 +0200 +++ b/zshrc-docker Thu Jul 05 04:58:14 2018 +0200 @@ -10,3 +10,11 @@ alias dpa="docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Names}}'" dex() { docker exec -it $1 /bin/sh } + +docker_remove_obsolete_images() { + docker rmi $(docker images --format 'table {{.Repository}} {{.ID}}' | grep -e '^' | awk '{ print $2 }') +} + +docker_remove_exited_containers() { + docker rm $(docker ps -a | grep "Exited" | awk '{print $(NF)}') +}