刪掉不在運行的docker: #!/bin/sh if [ -f /tmp/docker.txt ] then rm -f /tmp/docker.txt fi docker ps -a |egrep -v Up|awk -F '[ ]+' '{print $1}'|sed 1d >/tmp/docker.txt while read line do docker rm $line done </tmp/docker.txt