• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
Docker | Clear Docker unused objects (images cache, stopped containers, unused networks, and unused local volumes)
  1. Clear images cache
  2. Clear stopped containers
  3. Clear unused networks
  4. Clear unused local volumes
  5. Clear all Docker unused objects (images, containers, networks, local volumes)

  1. Clear images cache
    You can use the command docker image prune to delete all dangling and intermediate images:

    First, let's list existing images:

    By default intermediate images are hidden, you need to use the option -a (--all) to list all images:

    Delete dangling images:

    Check that dangling and intermediate images were deleted:
  2. Clear stopped containers
    You can use the command docker container prune to delete all stopped containers:

    Let's start a container:

    Check the container (note that the container exited because it didn't run in foreground):

    Delete stopped containers:
  3. Clear unused networks
    You can use the command docker network prune to delete all unused networks:

    Create a test network:

    Delete unused networks:
  4. Clear unused local volumes
    You can use the command docker volume prune to delete all unused local volumes:

    Create a test volume:

    Delete unused volumes:

    Delete a specific volume:
  5. Clear all Docker unused objects (images, containers, networks, local volumes)
    You can also use the command docker system prune to delete all unused objects. This will delete images cache, stopped containers, unused networks, and unused local volumes:

    Delete unused objects:
© 2025  mtitek