This change is a little more bulletproof, though I am generally a huge fan of using grep and cut, but when you are doing something that removes containers explicit is good.
This will avoid inadvertently removing any containers which happen to have the word Exit in the name or command, and won't stop working if the output format of "docker ps -a" ever changes.
This change is a little more bulletproof, though I am generally a huge fan of using grep and cut, but when you are doing something that removes containers explicit is good.
This will avoid inadvertently removing any containers which happen to have the word Exit in the name or command, and won't stop working if the output format of "docker ps -a" ever changes.
docker ps -a --filter status=exited --format {{.ID}} | xargs docker rm