Docker tends to leave behind a bunch of stuff, because of what is often its use-case, a lot of that garbage tends to accumulate without you realizing it.

Until your filesystem will make you notice.

These are all the commands used to keep your Docker installation clean from unwanted files:

Please pay attention as these are the global ways to clean docker objects, I will not write about filtering or cleaning specific things. Refer to the Docker prune documentation for further understanding.

System Prune

As explained by the ominous warning:

$ docker system prune

WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

If you wanted to include volumes in this, then use this command:

$ docker system prune --volumes

Which will remove all volumes “not used by at least one container”

“Dangling images” aren’t all images

Simply doing

$ docker image prune

often isn’t enough, as it will exclusively remove “dangling” images, but with the flag -a

$ docker image prune -a

WARNING! This will remove all images without at least one container associated with them.

will make it so every single unused image will get removed from your system, after months of using this is usually a lot, I think I’ve reached 10-12GBs at some point.

Clean your docker networks

Nothing special about this:

$ docker network prune

WARNING! This will remove all custom networks not used by at least one container.

Clean your docker volumes

Same as above:

$ docker volume prune

WARNING! This will remove all local volumes not used by at least one container.

You’re welcome.

Want to support me?

Find all information right here

You can also support me here:


  • My mom