Remove unused data including unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.
$ sudo docker system prune -a --volumes
[sudo] password for gary:
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all images without at least one container associated to them
- all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
416a299e53a68ea079aa7dbaefc26f2c5305ab38e7a0cd40266151443c01919a
Deleted Images:
untagged: nginx:latest
untagged: nginx@sha256:10b8cc432d53a93af434fd40e2ca4
deleted: sha256:ec7862903161761170ecf883b3a206793ef
deleted: sha256:32b128938da8ce4d63a98bed31ad0cd11dc
deleted: sha256:e8a2dea6c4dbd41f833d1fb74fe3e46841a
deleted: sha256:c2394470c6ba004ce651e8048d6d373c385
untagged: ubuntu:16.04
untagged: ubuntu@sha256:3355b4204fac81912a16eb463879
Total reclaimed space: 2.945GB