Cleanup Docker Trash

Over time, docker images and residual unneeded files pile up and take a lot of space.

We need to cleanup the following:

  • stopped containers
  • networks not used by at least one container
  • dangling images
  • build cache

To do that, just run:

docker system prune

It might take some time.

Enjoy a clean environment!

Sample:

WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Deleted Images:
untagged: xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx

Total reclaimed space: 17.89GB

Source:

https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

About SoCRaT

Research Support and Infrastructure Engineer, OSS & Linux Geek
This entry was posted in docker, Linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s