---
title: "Discussion on \"Cleaning up after Docker\" | Hashnode"
description: "Discussion on \"Cleaning up after Docker\". Often times you want to remove all docker images and all docker containers. When you're experimenting with images, it gets a bit painful to manually remove each image / container individually.\nTo remove all containers:\ndocker stop $(docker ps -a -q)\n..."
url: "https://hashnode.com/posts/cleaning-up-after-docker/58ede57af8429c5fdc4b797b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Cleaning up after Docker](https://hashnode.com/post/cleaning-up-after-docker?utm_source=hashnode&utm_medium=feed)

Often times you want to remove all docker images and all docker containers. When you're experimenting with images, it gets a bit painful to manually remove each image / container individually. To remove all containers: docker stop $(docker ps -a -q) ...

Apr 12, 2017 · hashnode.com  
Read the article

-   [#docker](https://hashnode.com/tag/docker)

## Written by

[Jan Vladimir Mostert](https://hashnode.com/@JanVladimirMostert)

@JanVladimirMostert · The Internet

  
[View profile](https://hashnode.com/@JanVladimirMostert)

Idea Incubator

idea-incubator - \[ahy-dee-uh-in-kyuh-bey-ter\] - noun taking ideas, turning them into products and turning them into businesses

## Responses 3

Markdown supported · ⌘↵ to post

[Anthony Lapenna](https://hashnode.com/@deviantony)

[Apr 19, 2017](https://hashnode.com/posts/cleaning-up-after-docker/58ede57af8429c5fdc4b797b/comment/58f77b4fb79c6f6bd1d85e02)

Nice, note that you can use the following one-liners too:

```
# Remove all dangling images (unused images)
$ docker rmi $(sudo docker images -q -f "dangling=true")

# Remove all dangling volumes (unused volumes)
$ docker volume rm $(docker volume ls -q -f "dangling=true")
```

[Jaydeep Solanki](https://hashnode.com/@jaydp17)

[Apr 22, 2017](https://hashnode.com/posts/cleaning-up-after-docker/58ede57af8429c5fdc4b797b/comment/58fbac6c816c6224e8dd2eb7)

Since docker v1.13, a few new commands were added

```
# shows used space, similar to the unix tool df
$ docker system df

# Removes all unused containers, volumes, networks and images (both dangling and unreferenced)
$ docker system prune
```

More about those commands: [docs.docker.com/engine/reference/commandline/syst…](https://docs.docker.com/engine/reference/commandline/system_prune/)

[Jan Vladimir Mostert](https://hashnode.com/@JanVladimirMostert)

[Apr 23, 2017](https://hashnode.com/posts/cleaning-up-after-docker/58ede57af8429c5fdc4b797b/comment/58fbac6c816c6224e8dd2eb7#reply-58fc95b6aa06c9b75c40dbb9)

This looks useful!

[Gaël Reyrol](https://hashnode.com/@Zevran)

[Apr 20, 2017](https://hashnode.com/posts/cleaning-up-after-docker/58ede57af8429c5fdc4b797b/comment/58f89d17b83c156ad18e0adc)

You should use docker-gc by Spotify, it's a garbage collector for docker images and containers.

[github.com/spotify/docker-gc](https://github.com/spotify/docker-gc)
