0

Remove all container from an specific network (docker)

 $ docker ps -a -f network=$NETWORK --format='{{.ID}}' | xargs docker rm -f

— by gatero on Aug. 17, 2018, 4:38 p.m.

Explanation

docker ps -a -f network=$NETWORK --format='{{.ID}}' returns the id's of all container that are subscribed to the network and pass the output to xargs docker rm -f that stop and deletes each container