FahamLah

Commands

docker system prune

docker system prune [-a] [--volumes]

Risk: Can lose work

What it does

Deletes stopped containers, unused networks, dangling images and build cache.

When to use it

Big clean-up. Read the warning before you type y.

Example

$ docker system prune

It asks first. y deletes, N keeps.

$ docker container prune

Only stopped containers.

$ docker image prune -a

Every image no container uses.

$ docker volume prune

Unused unnamed volumes. With -a: all unused volumes!

$ docker builder prune

Old build cache.