Skip to content

Instantly share code, notes, and snippets.

@dbellotti
Forked from bastman/docker-cleanup-resources.md
Last active September 13, 2018 16:56
Show Gist options
  • Select an option

  • Save dbellotti/0ee403b365515847a62774a21310abe6 to your computer and use it in GitHub Desktop.

Select an option

Save dbellotti/0ee403b365515847a62774a21310abe6 to your computer and use it in GitHub Desktop.

Revisions

  1. dbellotti revised this gist Sep 13, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@ Once in a while, you may need to cleanup resources (containers, volumes, images,

    // macOS - pathing might be different on your machine

    $ ls -la ~/Library/Containers/com.docker.docker/Data/
    # look for the results using a lot of space (lets say it is `com.docker.driver.amd64-linux)
    $ ls -la ~/Library/Containers/com.docker.docker/Data/

    # nuke it
    $ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
  2. dbellotti revised this gist Sep 13, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,14 @@

    Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

    ## 🐳 just remove all container data
    ## 🐳 find and remove naughty containers

    // macOS - pathing might be different on your machine

    $ ls -la ~/Library/Containers/com.docker.docker/Data/
    # look for the results using a lot of space (lets say it is `com.docker.driver.amd64-linux)

    # nuke it
    $ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

    ## delete volumes
  3. dbellotti revised this gist Sep 13, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

    ## 🐳just remove all container data
    ## 🐳 just remove all container data

    // macOS - pathing might be different on your machine

  4. dbellotti revised this gist Sep 13, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

    ## remove all container data
    ## 🐳just remove all container data

    // macOS - pathing might be different on your machine

  5. dbellotti revised this gist Sep 13, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ Once in a while, you may need to cleanup resources (containers, volumes, images,
    ## remove all container data

    // macOS - pathing might be different on your machine

    $ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

    ## delete volumes
  6. dbellotti revised this gist Sep 13, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    # Docker - How to cleanup (unused) resources

    Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

    ## remove all container data

    // macOS - pathing might be different on your machine
    $ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

    ## delete volumes

  7. @bastman bastman created this gist Mar 31, 2016.
    39 changes: 39 additions & 0 deletions docker-cleanup-resources.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # Docker - How to cleanup (unused) resources

    Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

    ## delete volumes

    // see: https://github.com/chadoe/docker-cleanup-volumes

    $ docker volume rm $(docker volume ls -qf dangling=true)
    $ docker volume ls -qf dangling=true | xargs -r docker volume rm

    ## delete networks

    $ docker network ls
    $ docker network ls | grep "bridge"
    $ docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')

    ## remove docker images

    // see: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images

    $ docker images
    $ docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

    $ docker images | grep "none"
    $ docker rmi $(docker images | grep "none" | awk '/ / { print $3 }')

    ## remove docker containers

    // see: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images

    $ docker ps
    $ docker ps -a
    $ docker rm $(docker ps -qa --no-trunc --filter "status=exited")

    ## Resize disk space for docker vm

    $ docker-machine create --driver virtualbox --virtualbox-disk-size "40000" default