Clean a Docker development environment

Docker

Docker disk usage is high and stale containers/images are piling up.

  1. See disk usage

    docker system df
  2. Remove stopped containers

    docker container prune -f
    Destructive
  3. Remove dangling images

    docker image prune -f
    Destructive
  4. Aggressive full cleanup

    docker system prune -a --volumes -f
    Destructive

Notes

  • Start with targeted prune commands first.
  • The full prune command can remove images/volumes needed later.

Related commands: docker ps -a, docker system prune, docker volume ls

Related workflows: Clean Docker disk usage