markdown docker cleanup guide:容器,图像,卷,网络

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown docker cleanup guide:容器,图像,卷,网络相关的知识,希望对你有一定的参考价值。

# 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
    

以上是关于markdown docker cleanup guide:容器,图像,卷,网络的主要内容,如果未能解决你的问题,请参考以下文章

markdown docker cleanup guide:容器,图像,卷,网络

markdown docker cleanup guide:容器,图像,卷,网络

markdown docker cleanup guide:容器,图像,卷,网络

markdown docker cleanup guide:容器,图像,卷,网络

markdown kernal-cleanup.md

markdown docker-composeを使ったrails gとか