cd /usr/bin/

touch rm-container rm-image rm-images

gedit rm-container

#!/bin/sh
docker ps -aq | xargs docker stop
docker ps -aq | xargs docker rm
docker ps -a

gedit rm-images

#!/usr/bin/env python2
#-*- coding:utf-8 -*-
import os
import sys

ls_cmd='docker images | grep "none"'
ls_result=os.popen(ls_cmd)
for line in ls_result.readlines():
        line=line.split()
        print line[2]
        os.popen('docker rmi %s'%(line[2]))
os.system('docker images')

chmod 777 rm-container rm-images

12-29 19:36