Skip to content

Commit

Permalink
changed xargs calls to use '--no-run-if-empty'
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmorano committed Apr 20, 2014
1 parent 2093d14 commit b3d2ad4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions functions.d/00-docker-baids
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ function docker-container-inspect-most-recent() {

function docker-container-remove-all() {

docker ps -a | grep -v ^CONTAINER | awk '{print $1}' | xargs -I % sh -c "docker kill %; docker rm %"
docker ps -a | grep -v ^CONTAINER | awk '{print $1}' | xargs -rI % sh -c "docker kill %; docker rm %"

}

function docker-container-remove-all-non-running() {

docker ps -a | grep -v ^CONTAINER | grep Exit | awk '{print $1}' | xargs -I % sh -c "docker kill %; docker rm %"
docker ps -a | grep -v ^CONTAINER | grep Exit | awk '{print $1}' | xargs -rI % sh -c "docker kill %; docker rm %"

}

Expand All @@ -113,12 +113,12 @@ function docker-image-most-recent() {
function docker-image-remove-all() {

docker-container-remove-all
docker images -a | grep -v ^REPOSITORY | awk '{print $3}' | xargs docker rmi &> /dev/null
docker images -a | grep -v ^REPOSITORY | awk '{print $3}' | xargs -r docker rmi

}

function docker-image-remove-orphan() {

docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi
docker images | grep "<none>" | awk '{print $3}' | xargs -r docker rmi

}

0 comments on commit b3d2ad4

Please sign in to comment.