Removing all docker containers in one go
docker container rm `docker ps -a | cut -f 1 -d " " | tr "\n" " "`
We are using command line substitution with the ``, and populating the container ids inside it. The cut gets the first field from docker ps, that is the id, and the tr replaces the newline with a space, so that we get all ids in a single line.
Btw, this will also work in the new Linux Subsystem for Windows(LSW) command line, its able to see the docker container created from windows command line.
No comments:
Post a Comment