I E

Docker Cleanup Commands

07 November 2020

I’ve Googled this one too many times, so I’m writing it here for future reference.

#! /usr/bin/env bash

# remove containers
docker ps --all --format "{{.ID}}" | xargs docker rm

# remove images
docker images --format "{{.ID}}" | xargs docker rmi -f

# remove volumes
docker volume prune

# remove build cache
docker builder prune