Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save El-Sam/0922374ddb0d9642e3bf23b87f3c6857 to your computer and use it in GitHub Desktop.

Select an option

Save El-Sam/0922374ddb0d9642e3bf23b87f3c6857 to your computer and use it in GitHub Desktop.

Revisions

  1. @ngpestelos ngpestelos revised this gist May 26, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions remove-docker-containers.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    1. Delete all containers

    $ docker ps -q -a | xargs docker rm
    $ docker ps -q -a | xargs docker rm

    -q prints only the container IDs
    -a prints all containers
    @@ -9,6 +9,6 @@ Notice that it uses xargs to issue a remove container command for each container

    2. Delete all untagged images

    $ docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)
    $ docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)

    awk must use a single quote (this filters all image IDs)
  2. @ngpestelos ngpestelos revised this gist May 26, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions remove-docker-containers.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    1. Delete all containers

    docker ps -q -a | xargs docker rm
    $ docker ps -q -a | xargs docker rm

    -q prints only the container IDs
    -a prints all containers
    @@ -9,6 +9,6 @@ Notice that it uses xargs to issue a remove container command for each container

    2. Delete all untagged images

    docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)
    $ docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)

    awk must use a single quote (this filters all image IDs)
  3. @ngpestelos ngpestelos created this gist May 26, 2014.
    14 changes: 14 additions & 0 deletions remove-docker-containers.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    1. Delete all containers

    docker ps -q -a | xargs docker rm

    -q prints only the container IDs
    -a prints all containers

    Notice that it uses xargs to issue a remove container command for each container ID

    2. Delete all untagged images

    docker rmi $(docker images | grep “^<none>” | awk ‘{print $3}’)

    awk must use a single quote (this filters all image IDs)