CleanUpDocker: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(Added CleanUpDocker)
 
No edit summary
Line 3: Line 3:
$ docker ps -a | cut -f 1 -d" " | xargs docker rm
$ docker ps -a | cut -f 1 -d" " | xargs docker rm
$ docker images | awk '{print $3}' | xargs docker rmi
$ docker images | awk '{print $3}' | xargs docker rmi
</syntaxhighlight>
Work around:
<syntaxhighlight>
docker ps -a -f status=dead -q | xargs -r -I % bash -c 'rm -rf /srv/docker/overlay/%1*'
docker ps -a -f status=dead -q | xargs -r docker rm -f -v
</syntaxhighlight>
</syntaxhighlight>

Revision as of 14:38, 24 January 2018

Remove all containers then remove all images

$ docker ps -a | cut -f 1 -d" " | xargs docker rm
$ docker images | awk '{print $3}' | xargs docker rmi

Work around:

 
docker ps -a -f status=dead -q | xargs -r -I % bash -c 'rm -rf /srv/docker/overlay/%1*'
docker ps -a -f status=dead -q | xargs -r docker rm -f -v