Skip to content

Instantly share code, notes, and snippets.

@avitsidis
avitsidis / gist:2c33371a2ae2d59cd80ac3e5f33c703c
Last active March 14, 2017 10:25 — forked from eduardocardoso/gist:82a629882ddb02ab3677
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi