Skip to content

Instantly share code, notes, and snippets.

@alekc
Forked from beeman/remove-all-from-docker.sh
Last active November 7, 2018 15:43
Show Gist options
  • Select an option

  • Save alekc/2f8bae86f2ad499a610eeb8225859f10 to your computer and use it in GitHub Desktop.

Select an option

Save alekc/2f8bae86f2ad499a610eeb8225859f10 to your computer and use it in GitHub Desktop.

Revisions

  1. alekc revised this gist Nov 7, 2018. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions remove-all-from-docker.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    docker system prune
    docker volume prune
    docker rmi -f `docker images -qa `

    # Stop all containers
    docker stop `docker ps -qa`

    # Remove all containers
    docker rm `docker ps -qa`

    # Remove all images
    docker rmi -f `docker images -qa `

    # Remove all volumes
    docker volume rm $(docker volume ls -qf)

  2. @beeman beeman created this gist Nov 15, 2016.
    25 changes: 25 additions & 0 deletions remove-all-from-docker.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # Stop all containers
    docker stop `docker ps -qa`

    # Remove all containers
    docker rm `docker ps -qa`

    # Remove all images
    docker rmi -f `docker images -qa `

    # Remove all volumes
    docker volume rm $(docker volume ls -qf)

    # Remove all networks
    docker network rm `docker network ls -q`

    # Your installation should now be all fresh and clean.

    # The following commands should not output any items:
    # docker ps -a
    # docker images -a
    # docker volume ls

    # The following command show only show the default networks:
    # docker network ls